BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-22-2008, 06:49 PM   #1
Slayer3600
New Member
 
Join Date: Jul 2007
Model: 8830
PIN: N/A
Carrier: Sprint
Posts: 4
Default ksoap2 parameters to .net webservice - can we put this to bed?

Please Login to Remove!

Yes I am posting yet another ksoap2 thread...I apologize in advance!

I can succesfully call a .Net (ASP.net 2.0) webservice with ksoap2 without parameters and recieve the expected response. I cannot however get a .Net webservice to accept parameters from ksoap2. Just so you know that I'm not just blasting out an unaswered question I have searched all over and come up with the following unaswered threads of this same exact issues (sorry I cannot post links):

blackberryforums.com/developer-forum/43342-ksoap-net-parameters.html
blackberryforums.com/developer-forum/136630-pass-parmeters-net-webservice-using-ksoap2.html
blackberryforums.com/blackberry-network/125169-jde-soap-request-net-web-service.html
discussion.forum.nokia.com/forum/showthread.php?t=131532

There seems to be some confusion whether this is a ksoap2 issue or a .Net webservice issue. I'm also curious if there is some finallity on what attributes are required on the .Net web service side to get ksoap2 to work with parameters.

I have the following client code:

Code:
    private void callRegWebService()
    {
            String serviceUrl = "h t t p : / / myurl/myservice.asmx";
            String serviceNamespace = "h t t p : / / w w w . mynamespace.com";
            String soapAction = "h t t p : / / w w w . mynamespace.com/HelloBBerry";
            String methodName = "HelloBBerry";
            
            SoapObject rpc = new SoapObject(serviceNamespace, methodName);
            rpc.addProperty("DeviceID","Sent From BlackBerry!");

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

            envelope.bodyOut = rpc;
            envelope.dotNet = true;
            envelope.encodingStyle = SoapSerializationEnvelope.ENC;

            HttpTransport ht = new HttpTransport(serviceUrl);
            ht.debug = true;
            ht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); 

            String result = null;
            
            String request = null;
            String response = null;
            
            try
                {
                    ht.call(soapAction, envelope);
                    result = (envelope.getResult()).toString();
                    
                    request = ht.requestDump;
                    response = ht.responseDump;
                    
                     System.out.println(request);
                    
                    if (result.toLowerCase().equals("true")){
                        _isRegistered = true;
                    }
                }
            catch(org.xmlpull.v1.XmlPullParserException ex2){

                }
                    catch(Exception ex){
                    String bah = ex.toString();
                }

    }
I have the following .Net web service:

Code:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel

<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
<System.Web.Services.WebService(Namespace:="h t t p : / / w w w . mynamespace.com/")> _
Public Class trackberry
    Inherits System.Web.Services.WebService


    <WebMethod()> _
    Public Function HelloBBerry(ByVal DeviceID As String) As String
        Return "BBerry Device ID: " & DeviceID 
    End Function

End Class
Some threads indicate that adding <SoapRpcMethod()> attribute to the method is required. However when I do this the call completely fails with a:

SoapFault - faultcode: 'soap:Client' faultstring: 'Server was unable to read request. ---> There is an error in XML document (1, 233). ---> <HelloBBerry xmlns='h t t p : / / w w w . mynamespace.com'> was not expected.' faultactor: 'null' detail: org.kxml2.kdom.Node@185ad2ec

I've also tried using the <SoapRpcService()> attribute at the class level with the same results.

If I remove the <SoapRpcMethod()> attribute as the code is posted above the call does not through an exception but the parameter is not recieved by the web service.

Has anybody gotten ksoap2 to work with .NET parameters and if so could you share with the community how you got this to work? Thanks in advance.

Last edited by Slayer3600; 09-22-2008 at 07:18 PM..
Offline  
Old 12-01-2008, 07:08 PM   #2
bharath001
New Member
 
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: att
Posts: 4
Default

I get the exact same error. any luck finding a solution?
Offline  
Old 12-01-2008, 10:51 PM   #3
bharath001
New Member
 
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: att
Posts: 4
Default

I found it. HERE is the solution

forums.sun.com/thread.jspa?threadID=5343657

I got that working by specifying encodingStyle for envelope.
Offline  
Old 02-15-2009, 02:15 PM   #4
sphynx4868
New Member
 
Join Date: Feb 2009
Model: 8703e
PIN: N/A
Carrier: sprint
Posts: 1
Default What encodingStyle?

What encodingStyle did you use? I am having this same issue...

Quote:
Originally Posted by bharath001 View Post
I found it. HERE is the solution

forums.sun.com/thread.jspa?threadID=5343657

I got that working by specifying encodingStyle for envelope.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Winco VSW-20W, 20-Ounce White Swirl Insulated Beverage Server picture

Winco VSW-20W, 20-Ounce White Swirl Insulated Beverage Server

$14.99



5 pieces Plenum Fiber Optic Cable jumper p/n 696912SJ88180F-EQ  180' server  New picture

5 pieces Plenum Fiber Optic Cable jumper p/n 696912SJ88180F-EQ 180' server New

$359.35



Server - 92020 - Double Dip Server picture

Server - 92020 - Double Dip Server

$348.84



EMC2 HPE-S HPES Server picture

EMC2 HPE-S HPES Server

$465.00



Wti Console Server + PDU CPM-800-1-EA picture

Wti Console Server + PDU CPM-800-1-EA

$550.00



NEW FSP FSP350-701UH Server Power Supply 350W picture

NEW FSP FSP350-701UH Server Power Supply 350W

$149.56







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.