Loading ...
Sorry, an error occurred while loading the content.

change encoding betwenn 1999 to 2001

Expand Messages
  • Rushikesh Joshi
    Hi Friends, I am passing an Array to my webservices method. But it s not working. Below is code of it. ############################ Code Starts
    Message 1 of 2 , Aug 20 6:08 AM
    • 0 Attachment

      Hi Friends,

      I am passing an Array to my webservices method. But it's not working. Below is code of it.

      ############################ Code Starts ##################################
      use Data::Dumper;
      use SOAP::Lite +trace => 'debug';
      my $_debug_=1; #to check code in debug mode
      my $service=SOAP::Lite->service("/root/testing/myTestArray.wsdl"); #create soap lite object

      $username="rushi_asi\@...";
      $password="rrrrrr";
      $langref="en";
      $role="reseller";
      $parentid=11;

      #my array to pass
      @arrStr = ("A","B","C");

      #call stringArrTest method and save return value in some variable
      $strReturn=stringArrTest($username, $password, $role, $langref, $parentid, \@arrStr);
      prinrt $strReturn; #print returned value of stringArrTest method

      sub stringArrTest{
       my (@param)=@_;
       if ($_debug_) {
        print "\n/-------------------- In stringArrTest Method --------------------\\ \n";
       }
       #Call stringArrTest method of webservices and stores data in $stringArrTest variable
       my $stringArrTest = $service->stringArrTest(@param) or die ("Some Error at time of returning value");
       if ($_debug_) {
        print "\n Return Value in stringArrTest Method:...............\n";
        pritn "$stringArrTest","\n";
        print "\n\\-------------------- In End stringArrTest Method --------------------/ \n";
       }
       return $intTest;
      }
      ############################ end of code ##################################


      Below is dumps of XML that generated by my code
      ------------------------------------------------------------------------------------------
      <!--input (Request) XML Dump-->
      <!--output XML Dump-->
      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
           xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
           SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
           xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
           xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
           xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      <SOAP-ENV:Body>
      <namesp1:stringArrTest xmlns:namesp1="com.logicboxes.foundation.sfnb.user.Test">
      <userName xmlns:ns="http://www.w3.org/2001/XMLSchema" xsi:type="ns:string">rushi_asi@...</userName>
      <password xmlns:ns="http://www.w3.org/2001/XMLSchema" xsi:type="ns:string">rrrrrr</password>
      <role xmlns:ns="http://www.w3.org/2001/XMLSchema" xsi:type="ns:string">reseller</role>
      <langpref xmlns:ns="http://www.w3.org/2001/XMLSchema" xsi:type="ns:string">en</langpref>
      <parentid xmlns:ns="http://www.w3.org/2001/XMLSchema" xsi:type="ns:int">11</parentid>
      <stringArrParam
           SOAP-ENC:arrayType="xsd:string[3]"
           xmlns:ns="com.logicboxes.foundation.sfnb.user.Test"
           xsi:type="ns:ArrayOf_xsd_string">
           <item xsi:type="xsd:string">A</item>
           <item xsi:type="xsd:string">B</item>
           <item xsi:type="xsd:string">C</item>
      </stringArrParam>
      </namesp1:stringArrTest>
      </SOAP-ENV:Body></SOAP-ENV:Envelope>
      ------------------------------------------------------------------------------------------


      ------------------------------------------------------------------------------------------
      <!--output (Response) XML Dump-->
      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope
          xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <soapenv:Body>
        <soapenv:Fault>
         <faultcode>soapenv:Server.userException</faultcode>
         <faultstring>org.xml.sax.SAXException: No deserializer defined for array type {http://www.w3.org/1999/XMLSchema}string</faultstring>
         <detail/>
        </soapenv:Fault>
       </soapenv:Body>
      </soapenv:Envelope>
      ------------------------------------------------------------------------------------------


      ------------------------------------------------------------------------------------------
      <!--input (Request) of .NET & PHP XML Dump: This is working-->
      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
       SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/
       xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/
       xmlns:xsd="http://www.w3.org/2001/XMLSchema
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
       xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/
       xmlns:si="http://soapinterop.org/xsd
       xmlns:impl="com.logicboxes.foundation.sfnb.order.DomOrder">
      <SOAP-ENV:Body>
      <impl:stringArrTest>
      <userName xsi:type="xsd:string">rushi_asi@...</userName>
      <password xsi:type="xsd:string">rrrrrr</password>
      <role xsi:type="xsd:string">reseller</role>
      <langpref xsi:type="xsd:string">en</langpref>
      <parentid xsi:type="xsd:int">11</parentid>
      <stringArrParam xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[3]">
           <item xsi:type="xsd:string">A</item>
           <item xsi:type="xsd:string">B</item>
           <item xsi:type="xsd:string">C</item>
      </stringArrParam>
      </impl:stringArrTest>                                                        
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      ------------------------------------------------------------------------------------------


      Now using same wsdl file when webservices called from .NET Soap & PHP Soap Client it's working fine.

      I seems that only main difference between both request mehtod is.
      In case of Perl it convert to 1999 encoding and in case of .NET & PHP it is 2001 encoding.
      So how can i override this encoding style. (look in request xml files)


      Attachment:
      WSDL file: myTestArray.wsdl
      Perl Code: stringArrTest.pl
      XML dumps: ArrTestRequest.xml, ArrTestResponse.xml, WorkingRequest.xml

      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com

    • Mark Fuller
      ... You may have posted this before receiving Duncan s posting where he said: When you use WSDL the result of the call is the return value from the service.
      Message 2 of 2 , Aug 20 9:41 AM
      • 0 Attachment
        --- Rushikesh Joshi <rushi_asi@...> wrote:
        > my $stringArrTest = $service->stringArrTest(@param)
        > or die ("Some Error at time of returning value");

        You may have posted this before receiving Duncan's
        posting where he said:

        "When you use WSDL the result of the call is the
        return value from the service. To access the SOAP
        message you need to get the som object by using call()
        with no parameters."

        Mark



        __________________________________
        Do you Yahoo!?
        New and Improved Yahoo! Mail - Send 10MB messages!
        http://promotions.yahoo.com/new_mail
      Your message has been successfully submitted and would be delivered to recipients shortly.