none
Calling a SOAP service with MSSOAP.SoapClient30 - Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057 RRS feed

  • Question

  • There's a legacy application that can only do VBA and I am trying to integrate it with our services. The service are simple two methods that create and close a Jira issue and return Status complex type:

    <wsdl:definitions targetNamespace="JiraAdapter" name="Application">
      <wsdl:types>
        <xs:schema targetNamespace="JiraAdapter" elementFormDefault="qualified">
          <xs:complexType name="CreateJiraIssueWithBase64AttachmentResponse">
            <xs:sequence>
              <xs:element name="CreateJiraIssueWithBase64AttachmentResult" type="tns:Status" minOccurs="0" nillable="true"/>
            </xs:sequence>
          </xs:complexType>
          <xs:complexType name="CloseJiraIssue">
            <xs:sequence>
              <xs:element name="key" type="xs:string" minOccurs="0" nillable="true"/>
              <xs:element name="resolution_key" type="xs:integer" minOccurs="0" nillable="true"/>
            </xs:sequence>
          </xs:complexType>
          <xs:complexType name="CloseJiraIssueResponse">
            <xs:sequence>
              <xs:element name="CloseJiraIssueResult" type="tns:Status" minOccurs="0" nillable="true"/>
            </xs:sequence>
          </xs:complexType>
          <xs:complexType name="CreateJiraIssueWithBase64Attachment">
            <xs:sequence>
              <xs:element name="summary" type="xs:string" minOccurs="0" nillable="true"/>
              <xs:element name="base64attachment" type="xs:string" minOccurs="0" nillable="true"/>
              <xs:element name="attachment_filename" type="xs:string" minOccurs="0" nillable="true"/>
            </xs:sequence>
          </xs:complexType>
          <xs:complexType name="Status">
            <xs:sequence>
              <xs:element name="Code" type="xs:integer" minOccurs="0" nillable="true"/>
              <xs:element name="Message" type="xs:string" minOccurs="0" nillable="true"/>
            </xs:sequence>
          </xs:complexType>
          <xs:element name="Status" type="tns:Status"/>
          <xs:element name="CreateJiraIssueWithBase64Attachment" type="tns:CreateJiraIssueWithBase64Attachment"/>
          <xs:element name="CloseJiraIssueResponse" type="tns:CloseJiraIssueResponse"/>
          <xs:element name="CloseJiraIssue" type="tns:CloseJiraIssue"/>
          <xs:element name="CreateJiraIssueWithBase64AttachmentResponse" type="tns:CreateJiraIssueWithBase64AttachmentResponse"/>
        </xs:schema>
      </wsdl:types>
      <wsdl:message name="CreateJiraIssueWithBase64Attachment">
        <wsdl:part name="CreateJiraIssueWithBase64Attachment" element="tns:CreateJiraIssueWithBase64Attachment"/>
      </wsdl:message>
      <wsdl:message name="CreateJiraIssueWithBase64AttachmentResponse">
        <wsdl:part name="CreateJiraIssueWithBase64AttachmentResponse" element="tns:CreateJiraIssueWithBase64AttachmentResponse"/>
      </wsdl:message>
      <wsdl:message name="CloseJiraIssue">
        <wsdl:part name="CloseJiraIssue" element="tns:CloseJiraIssue"/>
      </wsdl:message>
      <wsdl:message name="CloseJiraIssueResponse">
        <wsdl:part name="CloseJiraIssueResponse" element="tns:CloseJiraIssueResponse"/>
      </wsdl:message>
      <wsdl:service name="JiraAdapter">
        <wsdl:port name="Application" binding="tns:Application">
          <soap:address location="http://localhost:7777/"/>
        </wsdl:port>
      </wsdl:service>
      <wsdl:portType name="Application">
        <wsdl:operation name="CreateJiraIssueWithBase64Attachment" parameterOrder="CreateJiraIssueWithBase64Attachment">
          <wsdl:input name="CreateJiraIssueWithBase64Attachment" message="tns:CreateJiraIssueWithBase64Attachment"/>
          <wsdl:output name="CreateJiraIssueWithBase64AttachmentResponse" message="tns:CreateJiraIssueWithBase64AttachmentResponse"/>
        </wsdl:operation>
        <wsdl:operation name="CloseJiraIssue" parameterOrder="CloseJiraIssue">
          <wsdl:input name="CloseJiraIssue" message="tns:CloseJiraIssue"/>
          <wsdl:output name="CloseJiraIssueResponse" message="tns:CloseJiraIssueResponse"/>
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="Application" type="tns:Application">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="CreateJiraIssueWithBase64Attachment">
          <soap:operation soapAction="CreateJiraIssueWithBase64Attachment" style="document"/>
          <wsdl:input name="CreateJiraIssueWithBase64Attachment">
            <soap:body use="literal"/>
          </wsdl:input>
          <wsdl:output name="CreateJiraIssueWithBase64AttachmentResponse">
            <soap:body use="literal"/>
          </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="CloseJiraIssue">
          <soap:operation soapAction="CloseJiraIssue" style="document"/>
          <wsdl:input name="CloseJiraIssue">
            <soap:body use="literal"/>
          </wsdl:input>
          <wsdl:output name="CloseJiraIssueResponse">
            <soap:body use="literal"/>
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
    </wsdl:definitions>
    

    I found an example of using soap services and adjusted it to my services:

    WSDLFileName = "http://localhost:7777/?wsdl"
            base64attachment = "UG9ydG1hbiBpcyBwb3J0Zm9saW8gbWFuYWdlbWVudCBzb2Z0d2FyZSB0byBoZWxwIFBNTyBrZWV"
            attachment_filename = "test_file.txt"
            summary = "test issue with summary"
            SoapClient = CreateObject("MSSOAP.SoapClient30")
            SoapClient.MSSoapInit(WSDLFileName)
            res = SoapClient.CreateJiraIssueWithBase64Attachment(summary, base64attachment, attachment_filename)
            Console.Out.WriteLine(res)

    And it is giving me error: Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057

    on the line before last.

    I think this is happening because it's expecting me to pass a complex type inside the function call - how do I do this?

    The services work ok - here's my test with SoapUI:

    Request:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:jir="JiraAdapter">
       <soapenv:Header/>
       <soapenv:Body>
          <jir:CreateJiraIssueWithBase64Attachment>
          <jir:summary>Test Summary</jir:summary>
             <jir:base64attachment>UG9ydG1hbiBpcyBwb3J0Zm9saW8gbWFuYWdlbWVudCBzb2Z0d2FyZSB0byBoZWxwIFBNTyBrZWVwIHRyYWNrIG9mIHRoZWlyIHByb2plY3RzLg0KKGMpIDIwMTIsIEFsZXhhbmRlciBCb2xvdG5vdiwgYWJvbG90bm92QGdtYWlsLmNvbQ==</jir:base64attachment>
             <jir:attachment_filename>hello.txt</jir:attachment_filename>
          </jir:CreateJiraIssueWithBase64Attachment>
       </soapenv:Body>
    </soapenv:Envelope>

    Response:

    <senv:Envelope xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing" xmlns:tns="JiraAdapter" xmlns:plink="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:senc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s12env="http://www.w3.org/2003/05/soap-envelope/" xmlns:s12enc="http://www.w3.org/2003/05/soap-encoding/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
       <senv:Body>
          <tns:CreateJiraIssueWithBase64AttachmentResponse>
             <tns:CreateJiraIssueWithBase64AttachmentResult>
                <tns:Code>20</tns:Code>
                <tns:Message>JUR-2379</tns:Message>
             </tns:CreateJiraIssueWithBase64AttachmentResult>
          </tns:CreateJiraIssueWithBase64AttachmentResponse>
       </senv:Body>
    </senv:Envelope>


    Thursday, April 18, 2013 9:52 AM