6 Replies Latest reply on Aug 27, 2008 12:21 PM by (Mike_J_B)

    asynchronous web service calls

      "error":"System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction:
      http://my-pc/AM85/submit.asmx?WSDL.\n at ....

      Here's my code:

      var mySync = {
      val:null,
      response: function(oResult, cURI)
      {
      this.val = oResult;
      },
      };

      var myRequest = {
      Save: {
      Username: Username,
      Password: Password,
      list: annotArray,
      }
      }

      Net.SOAP.request({
      cURL: WebService,
      oRequest: myRequest,
      oAsync: mySync,
      cAction: "http://my-pc/AM85/submit.asmx?WSDL"
      });

      And here's my synchronous call that works:

      var service = Net.SOAP.connect(WebService);

      //this line has no effect
      //service.asyncHandler = mySync;

      service.Save({
      Username: Username,
      Password: Password,
      list: annotArray,
      });
        • 1. Re: asynchronous web service calls
          Patrick Leckey Level 3
          Have you turned wireDump on to see how your SOAP messages differ for the two methods? This may give you some idea of where your request has gone wrong.

          You should read the documentation again. Your mySync object isn't setup properly, your myRequest object may work but certainly isn't up to best practice, and you're passing a URL to a WSDL as the action in your request which just doesn't make sense (not just in Acrobat, but in the SOAP standard).

          Have you worked with SOAP before? If not, probably best to read up on that a bit first - Acrobat 8.x and 9.x are SOAP 1.2 compliant. Also, is your WSDL setup for RPC or Literal?
          • 2. Re: asynchronous web service calls
            Level 1
            I google'd wiredump but didn't find anything.<br /><br />So if I make this change to the Net.SOAP.request call:<br />cAction: "http://mydomain.com/Save"<br /><br />then it hits my server code, but all the arguments are null.<br /><br />I tried this change as well but to no effect:<br /><br />var myRequest = {<br />"http://mydomain.com/:Save": {<br />Username: Username,<br />Password: Password,<br />list: annotArray,<br />}<br />} <br /><br /> I'm not sure if it's RPC or literal. How do I tell? If I view it in IE I get an xml document that starts like this:<br /><br />  <?xml version="1.0" encoding="utf-8" ?> <br />  <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://mydomain.com/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://mydomain.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"><br />  <wsdl:types><br />  <s:schema elementFormDefault="qualified" targetNamespace="http://mydomain.com/"><br />  <s:element name="Save"><br />   <s:complexType><br />    <s:sequence><br />     <s:element minOccurs="0" maxOccurs="1" name="Username" type="s:string" /> <br />     <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" /> <br />     <s:element minOccurs="0" maxOccurs="1" name="list" type="s:string" /> <br />    </s:sequence><br />   </s:complexType><br />  </s:element><br />  <br />  ...
            • 3. Re: asynchronous web service calls
              Patrick Leckey Level 3
              > I google'd wiredump but didn't find anything.

              Like I said, read the documentation. It's a property of Acrobat's SOAP object.

              > I tried this change as well but to no effect

              You seem to be just guessing at the namespace. Looking at your wiredump results will give you a better idea.

              > I'm not sure if it's RPC or literal. How do I tell?

              You're the one who wrote your WSDL, which method did you write it for? You actually cut off the WSDL before the part that would answer my question, but please don't spam the forums by posting the complete WSDL. If you're using VisualStudio and getting it to auto-generate your WSDL (never a great idea since you lose control over your applications interface, basically) then it will by default generate a WSDL setup for RPC, which makes async SOAP requests in Acrobat like the one you're trying much more difficult. Using the async method in Acrobat goes much smoother with a WSDL designed for literal messages.
              • 4. Re: asynchronous web service calls
                Level 1
                hm.. this part, perhaps? And yes, I'm pretty sure this document was autogenerated somehow.<br /><br /><wsdl:binding name="WSSubmitSoap" type="tns:WSSubmitSoap"><br />  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> <br />- <wsdl:operation name="Save"><br />  <soap:operation soapAction="http://mydomain.com/Save" style="document" /> <br />- <wsdl:input><br />  <soap:body use="literal" /> <br />  </wsdl:input><br />- <wsdl:output><br />  <soap:body use="literal" /> <br />  </wsdl:output><br /></wsdl:operation><br /><br />Ah! I got wireDump to work. So..<br /><br />WORKING SOAP:<br /><br /><?xml version="1.0"?><br /><SOAP-ENV:Envelope 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"><br /><SOAP-ENV:Body><br /><Save xmlns="http://mydomain.com/"><br /><Username>A</Username><br /><Password>a</Password><br /><list></list><br /></Save><br /></SOAP-ENV:Body><br /></SOAP-ENV:Envelope><br /><br />NOT WORKING SOAP:<br /><br /><?xml version="1.0"?><br /><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"><br /><SOAP-ENV:Body><br /><ns0:Save SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://mydomain.com/"><br /><Username xsi:type="xsd:string">A</Username><br /><Password xsi:type="xsd:string">a</Password><br /><list xsi:type="xsd:string"></list><br /></ns0:Save><br /></SOAP-ENV:Body><br /></SOAP-ENV:Envelope>
                • 5. Re: asynchronous web service calls
                  Patrick Leckey Level 3
                  > hm.. this part, perhaps

                  No. The body should be literal whether your WSDL is RPC or not. You have read the WSDL and SOAP specifications, right?

                  As you can see, your 'not working' request has an extra namespace declaration on the "Save" operation (in this case, "ns0:Save", ns0 being defined as "http://mydomain.com"), but you parameters have no namespace defined. In the SOAP documentation, you should read section for the soapQName property of the oRequest parameter. This should point you in the right direction.
                  • 6. Re: asynchronous web service calls
                    Level 1
                    Thanks for your help, PDL!

                    I changed myRequest to the following and it worked.

                    var myRequest = {
                    "http://mydomain.com/:Save" : {
                    "http://mydomain.com/:Username" : Username,
                    "http://mydomain.com/:Password" : Password,
                    "http://mydomain.com/:list" : annotArray,
                    }
                    };

                    I was not able to figure out soapQName. The documentation says it expects it to be an object with two properties, localName and nameSpace. However, the compiler expects it to be an array.