×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    159

    Web Services fail

    Hi,

    I'm failing with using the Web Services framework:

    I've used wsdl2cpp to create the required classes.
    In my code I call NewL on my service class.
    The consumer class's SetStatus method is called with KSenConnectionStatusReady, which should be the value after
    connecting. Strangely enough, it doesn't seem as if a connection has been established, because:
    • No access point selection popup was presented.
    • It all happens too fast (<8 miliseconds).
    • The server is located behind a private network, and to reach it, a specific wireless network must be connected.

    When I then try to send the SOAP request (using the generated class's service methods), I get a strange error code: -23654.

    What am I missing here?

    Code fragments can be found below.

    Please help,
    Thanks,
    Nadav

    Code:
    void
    CLoginConnectConsumer::ServiceL()
    {
    	...
    	
    	CSenXmlServiceDescription * serviceDesc =
    		CSenXmlServiceDescription::NewL( KMyServicesUrl, KNullDesC8() );
    	
    	serviceDesc->SetFrameworkIdL( KDefaultBasicWebServicesFrameworkID );
    
    	// After this call, SetStatus is called
    	iLoginConnectService = CLoginConnectServiceService::NewL(
    		*this, *serviceDesc );
    }
    
    void
    CLoginConnectConsumer::SetStatus(
    	const TInt aStatus )
    {	
    	switch( aStatus )
    	{
    		...
    
    		case KSenConnectionStatusReady:
    			// ===> This is called, and now, sending request...
    			{
    				TInt err = SendRequest(); // <=== This fails. See below
    				if ( err == KErrNone )
    					return;
    			}
    			break;
    
    		...			
    	}
    	
    	delete iLoginConnectService;
    	iLoginConnectService = NULL;
    }
    
    TInt
    CLoginConnectConsumer::SendRequest()
    {
    	RLoginConnectRequest    request;
    	RLoginConnectResponse   response;
    	CSenSoapFault         * soapFault = NULL;
    	
    	InitRequest( request ); // Initializing the request's parameters
    
    	// ====> Following line returns with err = -23654
    	TRAPD( err, iLoginConnectService->LoginConnectL( request, response, &soapFault ) );
    
    
    	if ( soapFault )
    	{
    		HandleSoapFaultL( *soapFault );
    		delete soapFault;
    	}
    	response.Close();
    	request.Close();
    
    	return err;
    }
    From generated code:
    Code:
    void
    CLoginConnectServiceService::LoginConnectL(
    	const RLoginConnectRequest  & aLoginConnectRequest,
    	RLoginConnectResponse       & aResult,
    	CSenSoapFault              ** aFault)
    {
    	if (NULL != aFault)
    		*aFault = NULL;
    
    	TPtrC8 reqStr;
    
    	// ===> Following line leaves with code -23654
    	Xsd::SenOps::ProcessOutgoingMessageLC(
    		aLoginConnectRequest,
    		"loginConnectRequest",
    		"http://myCompany.com/services/myServices",
    		"xdb",
    		reqStr );
    
    	...
    }
    Last edited by nadav70; 2008-05-29 at 15:26.

  2. #2
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    159

    Solution

    Ok, got the solution . Since other people might benefit from it, there it is:

    It turns out this error code (-23654) is generated in case SOAP request mal-formatted.

    Specifically in my case, I had not initialized a string field, and therefore, the request was invalid.

    Similar error can also occur if the reply is corrupted. For example, when the server fails to send a mandatory field. In this case, the error code would be -23634.

    Wish things were better documented. It would have saved me 2 days work. However, life's not always easy.

    Cheers,
    Nadav
    Last edited by nadav70; 2008-06-04 at 10:01.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    7

    Re: Web Services fail

    Hi Nadav,

    My application uses web-services. I've used WSDL to C++ tool to generate the code.

    The application works perfect for FP1 and FP2 devices (namely Nokia N73, N82, N95 and Nokia 78, 6220 classic) but it fails for E75 device.
    The return code is "-23634".

    Any idea why it behaves differently for E75, if it works great for other devices?

    Any kind of help is appreciated.

    Thanks,
    Shekhar

  4. #4
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    120

    Re: Web Services fail

    Hello shekhar,

    It is the same nadav by a different name .

    I'm not using wsdl2cpp anymore, because I've found that if trying to cancel a request (due to timeout) the code is getting stuck. So everything I say below is based only on an educated guess.

    According to my previous post it seems as if the server response is not as expected by your web-services class.
    If this happens only on E75, I would guess that the request sent by the E75 is somehow different than the request sent by other phones. As a result, the server may send a different reply or send an error, which results in the error code that you get.

    I would recommend:
    1. Check if some of the fields of the request contain phone-specific data.
    2. Use a sniffer to see exactly what is sent from client to server and vice versa.

    Good luck,
    Nadav

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    7

    Re: Web Services fail

    Hello Nadav,

    Thanks for the quick and clear reply. I’ll try as per your recommendation.

    Hoping your help in future too!!

    Thanks,
    Shekhar

  6. #6
    Regular Contributor
    Join Date
    Apr 2008
    Posts
    69

    Re: Web Services fail

    Hi

    I have found a work around that solved this problem on 5800, N86, 5630.

    First I begin with the problem. the function HandleMessageL(const TDesC8& aMessage)
    from the generated code receives xml without the xml header
    <?xml version=\"1.0\" ?>

    and some of calls return without the envelop header
    <S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">.

    I also rewrite the soap header.
    after doing all this work the parser works like a charm.
    I'd like to mention that the response from the server is the same for all working and non working devices
    the problem is with parsing of response in the different devices. I also noticed that the user agent is not
    the same.

    So the following is an example how to resolve the problem:

    _LIT8(KXMLHEADER,"<?xml version=\"1.0\" ?>");
    _LIT8(KMLENVELOP,"<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">");
    _LIT8(KXMLENDENVELOP,"</S:Envelope>");

    _LIT8(KDELBODY, "<S:Body xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">");
    _LIT8(KADD, "<S:Body>");

    void MDistributionClientServiceImplServiceConsumer::HandleMessageL(const TDesC8& aMessage)
    {
    TInt err = KErrNone;
    Xsd::SenOps::CProcessedIncomingMessage* procMsg = NULL;

    /////////////////here is my code//////////////////////////////////////////////
    TInt pos = aMessage.Find(KXMLHEADER);
    if(pos == KErrNotFound)
    {
    int len1, len2, len3, len4, count;
    len1 = KXMLHEADER().Length();
    len2 = KXMLENDENVELOP().Length();
    len3 = aMessage.Length();
    len4 = KXMLENDENVELOP().Length();
    count = len1 + len2 + len3 + + len4 + 100;
    HBufC8 *msg = HBufC8::NewMaxL(count);
    TPtr8 ptr(msg->Des ());
    ptr.SetLength(count);
    ptr.Copy(KXMLHEADER);
    pos = aMessage.Find(KMLENVELOP);

    if(pos == KErrNotFound)
    {
    ptr.Append(KMLENVELOP);
    ptr.Append(aMessage);
    ptr.Append(KXMLENDENVELOP);
    }
    else
    {
    ptr.Append(aMessage);
    }


    pos = ptr.Find(KDELBODY);
    if(pos != KErrNotFound)
    {
    ptr.Delete(pos, KDELBODY().Length());
    ptr.Insert(pos, KADD);
    }

    TRAP(err, procMsg = Xsd::SenOps::ProcessIncomingMessageL(*msg, ETrue))
    delete msg;
    }
    else
    {
    TRAP(err, procMsg = Xsd::SenOps::ProcessIncomingMessageL(aMessage, ETrue))
    }

    /////////////////////////////////////////////////////////////////////////////////

    // from here the code continues as usual
    if (err == KErrNone)
    {
    CleanupStack::PushL(procMsg);
    if ( procMsg->IsBodyContent("http://blabla", "keepAliveResponse") )
    {
    RKeepAliveResponse response;
    TRAP(err, procMsg->ExtractMessageL(response));
    if (err == KErrNone)
    {
    HandleKeepAliveResponseL(response);
    }
    }
    else if ( procMsg->IsBodyContent("http://") )
    {
    RLoginResponse response;
    TRAP(err, procMsg->ExtractMessageL(response));
    if (err == KErrNone)
    {
    HandleLoginResponseL(response);
    }
    }
    else if (procMsg->IsSoapFault())
    {
    CSenSoapFault *fault = procMsg->GetSoapFault();
    CleanupStack::PushL(fault);
    HandleSoapFaultL(*fault);
    CleanupStack::PopAndDestroy(fault);
    }
    else
    {
    err = Xsd::KErrXmlInvalidElement;
    }
    CleanupStack::PopAndDestroy(); // delete procMsg;
    }
    if (err != KErrNone)
    {
    HandleErrorL(err, Xsd::SenOps::KErrorHandleMsg);
    }

  7. #7
    Registered User
    Join Date
    Jan 2006
    Posts
    5

    Re: Web Services fail

    Hi,

    The work around code is working fine for E75

    Thanks,

Similar Threads

  1. Mobile web server and web services
    By landerluu in forum Mobile Web Server
    Replies: 1
    Last Post: 2008-01-03, 06:36
  2. Any tips - Web services on phone
    By rossmckinnon in forum Symbian
    Replies: 2
    Last Post: 2007-10-15, 13:37
  3. Accessing Web Services through MIDlet
    By divyas in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2006-06-06, 11:41
  4. web services on symbian...problem won't be resolved!!!
    By ashrafabdoh in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2005-09-16, 14:59

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×