Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 3 of 3

Thread: consuming external WSDL problem

  1. #1
    Junior Member
    Join Date
    Aug 2008
    Location
    Cairo
    Posts
    5

    Default consuming external WSDL problem

    i have webservice for external database,this web service has method "SendSMS" that take "SMSMessage" object and add record to this DB
    the generated SL for this WSDL appear like this:
    function
    sendSMS( )
    {
    this.$$nsPrefix ="tns";
    this.$$attributes =newArray();
    this.$$xmlNames =newArray();
    this.$$objNames =newArray();
    this.getName = getName;
    this.getXmlName = getXmlName;
    this.setContent = setContent;
    this.addContent = addContent;
    this.getContent = getContent;
    this.isFault = isFault;
    this.$$elementChildren =newArray();
    this.$$name ="sendSMS";
    this.$$xmlNames["sendSMS"]="tns:sendSMS";
    this.xmlns =newString("http://www.etisalat.com.eg/integration");
    this.$$attributes.push( "xmlns" );
    this.message =newsmsMessage();
    this.$$elementChildren.push( "message" );

    }
    functionsendSMSResponse( )
    {
    this.$$nsPrefix ="tns";
    this.$$attributes =newArray();
    this.$$xmlNames =newArray();
    this.$$objNames =newArray();
    this.getName = getName;
    this.getXmlName = getXmlName;
    this.setContent = setContent;
    this.addContent = addContent;
    this.getContent = getContent;
    this.isFault = isFault;
    this.$$elementChildren =newArray();
    this.$$name ="sendSMSResponse";
    this.$$xmlNames["sendSMSResponse"]="tns:sendSMSResponse";
    }
    functionsmsMessage( )
    {
    this.$$nsPrefix ="tns";
    this.$$attributes =newArray();
    this.$$xmlNames =newArray();
    this.$$objNames =newArray();
    this.getName = getName;
    this.getXmlName = getXmlName;
    this.setContent = setContent;
    this.addContent = addContent;
    this.getContent = getContent;
    this.isFault = isFault;
    this.$$elementChildren =newArray();
    this.$$name ="smsMessage";
    this.$$xmlNames["smsMessage"]="tns:smsMessage";
    this.application =newxs_string();
    this.$$elementChildren.push( "application" );
    this.contents =newxs_string();
    this.$$elementChildren.push( "contents" );
    this.externalApplicationIndicator =newxs_string();
    this.$$elementChildren.push( "externalApplicationIndicator" );
    this.lang =newxs_int();
    this.$$elementChildren.push( "lang" );
    this.password =newxs_string();
    this.$$elementChildren.push( "password" );
    this.priority =newxs_int();
    this.$$elementChildren.push( "priority" );
    this.reciever =newxs_string();
    this.$$elementChildren.push( "reciever" );
    this.scheduleDate =newxs_dateTime();
    this.$$elementChildren.push( "scheduleDate" );
    this.sender =newxs_string();
    this.$$elementChildren.push( "sender" );
    this.status =newxs_unsignedShort();
    this.$$elementChildren.push( "status" );
    }

    then i create my client to consume this WS
    the client code like this:

    functionsendSMS(application,contents,externalApplicationIndicator,lang,password,priority,reciever,sender)
    {
    //defining web-service client instance
    var webService =newlib.UnifiedSMSGateWayWSServiceProxy.UnifiedSMSGate WayWSService( );
     
    var request ;
    //creating request object for the web-service instance defined
    request =newlib.UnifiedSMSGateWayWSServiceProxy.sendSMS();
    //request=myrequest;
    newMessage =newlib.UnifiedSMSGateWayWSServiceProxy.smsMessage();

    newMessage.application.setValue(application);;
    newMessage.contents.setValue(contents);
    newMessage.externalApplicationIndicator.setValue(externalApplicationIndicator);
    newMessage.lang.setValue(lang);
    newMessage.password.setValue(password);
    newMessage.priority.setValue(priority);
    newMessage.reciever.setValue(reciever);
    // newMessage.scheduleDate.setValue(new Date());
    newMessage.sender.setValue(sender);
    newMessage.status.setValue("P");
    request.message=newMessage;
    try
    {
    //web-service invocation
    var response =webService.invoke(request);
    //declaring a variable containing plain soap response
    var soapResponse = webService.resultXML;


    print(soapResponse);
    }
    catch( e )
    {
    //Catching any exception occured. Block is skipped to avoid displaying unwanted warnings
    print("External failure. Description: \n"+e.toString());
    return RC_ERROR;
    }


    }

    but my client code may be incorrect becouse print(soapResponse) give me this result

    The passed argument to method sendSMS is null

    many thanks;

  2. #2
    Senior Member glg's Avatar
    Join Date
    Aug 2004
    Location
    Chicago, IL, USA
    Posts
    714

    Default

    One problem is that you're using the same function name for your code as is in the web service. That's bad form. You don't know which sendSMS function is giving the error there. Given that it's saying "passed argument", it sounds like however you called your function isn't working right (as the web service sendSMS function doesn't take in any passed arguments).

    First thing to do is to change your function name to avoid the conflict. Then you'll know where the error occurred.

  3. #3
    Junior Member
    Join Date
    Aug 2008
    Location
    Cairo
    Posts
    5

    Default

    many thanks for the concerns
    i changed the method name in my code to be sendNewSMS .
    also i ignored the passed arguments and used static values as follow
    newMessage.application.setValue("Portal");
    newMessage.contents.setValue("test");
    newMessage.externalApplicationIndicator.setValue("IM0001102979");..etc

    request.message=newMessage;


    also when reading the fields value it works fine as follow
    print(newMessage.externalApplicationIndicator.getV alue(); or print(request.message.externalApplicationIndicator .getValue();it prints "IM0001102979"

    which mean that the problem may occure when assigning the object "newMessage" to sendSMS method--- in this line (request.message=newMessage);

    error details:
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/><env:Body><env:Fault xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>env:Server</faultcode><faultstring>java.lang.IllegalArgumentEx ception: The passed argument to method sendSMS is null</faultstring></env:Fault></env:Body></env:Envelope>



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

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