获取java.lang.IllegalArgumentException:C#.net Web服务调用中的参数类型不匹配

时间:2013-05-02 09:59:31

标签: c# java asp.net web-services

我需要从我的c#asp.net Web应用程序调用Java Web服务。我有一个方法的下面的wsdl信息并生成了代理类

<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://myapp.mycompany.com/elo/services/ApplicationService" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://myapp.mycompany.com/elo/services/ApplicationService" xmlns:intf="http://myapp.mycompany.com/elo/services/ApplicationService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="urn:com:mycompany:elo:Trinity:classes" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  - <!-- 
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)

  -->
  - <wsdl:types>
    - <schema targetNamespace="http://myapp.mycompany.com/elo/services/ApplicationService" xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="urn:com:mycompany:elo:Trinity:classes" />
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
      -
      - <complexType name="SubmitPreApprovalApplicationRequest">
        - <complexContent>
          - <extension base="impl:ApplicationServiceRequest">
            - <sequence>
              <element name="AfpPreApprovalRequestId" type="xsd:int" />
              <element maxOccurs="1" minOccurs="0" name="CoBorrower" nillable="true" type="tns1:CoBorrower" />
              <element name="PrimaryApplicant" nillable="true" type="tns1:PrimaryApplicant" />
              <element name="RequestedAmount" nillable="true" type="xsd:decimal" />
              <element name="RequestedTermInMonths" type="xsd:int" />
              <element name="numberofCoborrowers" type="xsd:int" />
            </sequence>
          </extension>
        </complexContent>
      </complexType>
      - <complexType name="SubmitPreApprovalApplicationResponse">
        - <sequence>
          <element name="ResponseStatus" nillable="true" type="tns1:ResponseStatus" />
        </sequence>
      </complexType>
    </schema>
    - 
  </wsdl:types>
  - 
  - <wsdl:message name="submitPreApprovalApplicationResponse">
    <wsdl:part name="submitPreApprovalApplicationReturn" type="impl:SubmitPreApprovalApplicationResponse" />
  </wsdl:message>
  - <wsdl:message name="submitPreApprovalApplicationRequest">
    <wsdl:part name="request" type="impl:SubmitPreApprovalApplicationRequest" />
  </wsdl:message>
  - <wsdl:portType name="ApplicationService">
    - <wsdl:operation name="submitPreApprovalApplication" parameterOrder="request">
      <wsdl:input message="impl:submitPreApprovalApplicationRequest" name="submitPreApprovalApplicationRequest" />
      <wsdl:output message="impl:submitPreApprovalApplicationResponse" name="submitPreApprovalApplicationResponse" />
    </wsdl:operation>
    - 
  </wsdl:portType>
  - <wsdl:binding name="ApplicationServiceSoapBinding" type="impl:ApplicationService">
    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="submitPreApprovalApplication">
      <wsdlsoap:operation soapAction="" />
      - <wsdl:input name="submitPreApprovalApplicationRequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://classes.Trinity.elo.mycompany.com" use="encoded" />
      </wsdl:input>
      - <wsdl:output name="submitPreApprovalApplicationResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://myapp.mycompany.com/elo/services/ApplicationService" use="encoded" />
      </wsdl:output>
    </wsdl:operation>
    - 
  </wsdl:binding>
  - <wsdl:service name="ApplicationServiceService">
    - <wsdl:port binding="impl:ApplicationServiceSoapBinding" name="ApplicationService">
      <wsdlsoap:address location="http://myapp.mycompany.com/elo/services/ApplicationService" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

C#网络服务电话

       ApplicationServiceService service = new ApplicationServiceService();

       string version=  service.getVersion(); // This call works and fetches version

       service.Credentials = System.Net.CredentialCache.DefaultCredentials;
       SubmitPreApprovalApplicationRequest req = new SubmitPreApprovalApplicationRequest();
           req.prop=value// preparing all the properties

       res = service.submitPreApprovalApplication(req); //HERE IS THAT ERROR

可能是什么问题?任何1可以帮我解决吗?

P.S:我从wsdl中删除了一些对象,以便根据必要的细节最小化页面大小。

0 个答案:

没有答案