1 Reply Latest reply on Mar 13, 2014 6:35 AM by bqui

    SOAP issues

    bqui

      Hi,

      I'm new to this comunity.

      And I'm not shure if this is the right place for my question...

       

      This discussion was in 'Acrobat SDK', but now I think it's better in this forum...

       

       

      I'm working with Acrobat pro 11.0.06 on Mac OS X 10.8.5

       

      I try to connect from a PDF to a webservice via SOAP to get a database connection.

      The script sends some data to the service and expects a response with product data.

       

      The webservice is written in PHP.

      When I connect to the service via a php-script it works fine.

       

      This is the JavaScript function that calls the webservice:

       

      function getData()

      {

                var vartnr = "123456789";

                var vartnr_teil = "";//"3456789";

                var vpreis = "";//"0,36";

       

                try {

                          SOAP.wireDump = "true";

       

                          var strURL = "http://test.mydomain.de/webservice.wsdl";

                          var service = SOAP.connect(strURL);

                          var thedata = {

                                    artnr: vartnr,

                                    artnr_teil: vartnr_teil,

                                    preis: vpreis

                                    };

                          var results = service.getData(thedata);

       

                          app.alert(results);

                }

                catch(e)

                {

                          app.alert(e);

                }

      }

       

       

      When the script is running, I get an error message:

      'SOAPError: SOAP-ERROR: Encoding: Violation of encoding rules'.

       

      In the JavaScript-debugger of Acrobat I see the following message:

       

      <?xml version="1.0"?>

      <SOAP-ENV:Envelope xmlns:SOAP-ENC="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">

                <SOAP-ENV:Body>

                          <ns0:getData SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="urn:getData">

                                    <artnr>

                                              <artnr xsi:type="xsd:string">123456789</artnr>

                                              <artnr_teil xsi:type="xsd:string"></artnr_teil>

                                              <preis xsi:type="xsd:string"></preis>

                                    </artnr>

                                    <artnr_teil xsi:nil="true"/>

                                    <preis xsi:nil="true"/>

                          </ns0:getData>

                </SOAP-ENV:Body>

      </SOAP-ENV:Envelope>

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

                <SOAP-ENV:Body>

                          <SOAP-ENV:Fault>

                                    <faultcode>SOAP-ENV:Server</faultcode>

                                    <faultstring>SOAP-ERROR: Encoding: Violation of encoding rules</faultstring>

                          </SOAP-ENV:Fault>

                </SOAP-ENV:Body>

      </SOAP-ENV:Envelope>

       

       

      The first XML seems to represent the data that Acrobat sends to the webservice. The second XML seems to be the answer of the service.

       

      I don't know what exactly this means... where to look for the fault script...

       

      I see, that there is a bug in the first XML: '<artnr>' is closed twice.

      But this XML is generated throu the SOAP-object of Acrobat. So, I don't know how to change it.

       

      Any suggestions what to do?

      Thanks.

        • 1. Re: SOAP issues
          bqui Level 1

          Hello again,

           

          now I tried the same with Acobat pro 7 (7.1.0) on Windows XP.

           

          I got the same result: 'SOAP-ERROR: Encoding: Violation of encoding rules'.

           

          Mybe there are some lines in the wsdl-file, that cause this problem:

           

          <?xml version ='1.0' encoding ='UTF-8' ?>

          <definitions name='myService'

                    targetNamespace='http://test.mydomain.de/getData'

                    xmlns:tns='http://test.mydomain.de/getData'

                    xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'

                    xmlns:xsd='http://www.w3.org/2001/XMLSchema'

                    xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'

                    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'

                    xmlns='http://schemas.xmlsoap.org/wsdl/'>

           

                    <message name='addRequest'>

                              <part name='artnr' type='xsd:string'/>

                              <part name='artnr_teil' type='xsd:string'/>

                              <part name='preis' type='xsd:string'/>

                    </message>

                    <message name='addResponse'>

                              <part name='result' type='xsd:string'/>

                    </message>

           

                    <portType name='addPortType'>

                              <operation name='getData'>

                                        <input message='tns:addRequest'/>

                                        <output message='tns:addResponse'/>

                              </operation>

                    </portType>

           

                    <binding name='addBinding' type='tns:addPortType'>

                              <soap:binding style='rpc'

                              transport='http://schemas.xmlsoap.org/soap/http'/>

                              <operation name='getData'>

                                        <soap:operation soapAction='urn:myserver#getData'/>

                                        <input>

                                                  <soap:body use='encoded' namespace='urn:getData'

                                                  encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>

                                        </input>

                                        <output>

                                                  <soap:body use='encoded' namespace='urn:getData'

                                                  encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>

                                        </output>

                              </operation>

                    </binding>

           

                    <service name='addService'>

                              <port name='addPort' binding='addBinding'>

                                        <soap:address location='http://test.mydomain.de/myserver.php'/>

                              </port>

                    </service>

          </definitions>

           

           

          So again: Any suggestions what to do?

          Thanks.