如何在java

时间:2018-01-30 15:56:02

标签: java web-services soap wsdl soap-client

我有一个wsdl,看起来像: <?xml version="1.0" encoding="utf-8"?> <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="https://mcs-swa.com/HHP_IMEI_Validation/" 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="https://mcs-swa.com/HHP_IMEI_Validation/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <s:schema elementFormDefault="qualified" targetNamespace="https://mcs-swa.com/HHP_IMEI_Validation/"> <s:element name="SaleConfirmationDetail"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="RequestId" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="ImeiNo" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="date" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="status" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="skuCode" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="channel" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="SaleConfirmationDetailResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="SaleConfirmationDetailResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="AuthHeader" type="tns:AuthHeader" /> <s:complexType name="AuthHeader"> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="Username" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" /> </s:sequence> <s:anyAttribute /> </s:complexType> <s:element name="IMEISaleConfirmation"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="RequestId" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="ImeiNo" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="date" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="status" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="skuCode" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="channel" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="IMEISaleConfirmationResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="IMEISaleConfirmationResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="SaleConfirmation_NFBC"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="RequestId" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="ImeiNo" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="date" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="status" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="SkuCode" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="ChannelCode" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="SaleConfirmation_NFBCResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="SaleConfirmation_NFBCResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="SaleConfirmation"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="RequestId" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="ImeiNo" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="date" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="status" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="skuCode" type="s:string" /> <s:element minOccurs="0" maxOccurs="1" name="channel" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="SaleConfirmationResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="SaleConfirmationResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="string" nillable="true" type="s:string" /> </s:schema> </wsdl:types> <wsdl:message name="SaleConfirmationDetailSoapIn"> <wsdl:part name="parameters" element="tns:SaleConfirmationDetail" /> </wsdl:message> <wsdl:message name="SaleConfirmationDetailSoapOut"> <wsdl:part name="parameters" element="tns:SaleConfirmationDetailResponse" /> </wsdl:message> <wsdl:message name="SaleConfirmationDetailAuthHeader"> <wsdl:part name="AuthHeader" element="tns:AuthHeader" /> </wsdl:message> <wsdl:message name="IMEISaleConfirmationSoapIn"> <wsdl:part name="parameters" element="tns:IMEISaleConfirmation" /> </wsdl:message> <wsdl:message name="IMEISaleConfirmationSoapOut"> <wsdl:part name="parameters" element="tns:IMEISaleConfirmationResponse" /> </wsdl:message> <wsdl:message name="IMEISaleConfirmationAuthHeader"> <wsdl:part name="AuthHeader" element="tns:AuthHeader" /> </wsdl:message> <wsdl:message name="SaleConfirmation_NFBCSoapIn"> <wsdl:part name="parameters" element="tns:SaleConfirmation_NFBC" /> </wsdl:message> <wsdl:message name="SaleConfirmation_NFBCSoapOut"> <wsdl:part name="parameters" element="tns:SaleConfirmation_NFBCResponse" /> </wsdl:message> <wsdl:message name="SaleConfirmation_NFBCAuthHeader"> <wsdl:part name="AuthHeader" element="tns:AuthHeader" /> </wsdl:message> <wsdl:message name="SaleConfirmationSoapIn"> <wsdl:part name="parameters" element="tns:SaleConfirmation" /> </wsdl:message> <wsdl:message name="SaleConfirmationSoapOut"> <wsdl:part name="parameters" element="tns:SaleConfirmationResponse" /> </wsdl:message> <wsdl:message name="SaleConfirmationAuthHeader"> <wsdl:part name="AuthHeader" element="tns:AuthHeader" /> </wsdl:message> <wsdl:message name="SaleConfirmationDetailHttpGetIn"> <wsdl:part name="RequestId" type="s:string" /> <wsdl:part name="ImeiNo" type="s:string" /> <wsdl:part name="date" type="s:string" /> <wsdl:part name="status" type="s:string" /> <wsdl:part name="skuCode" type="s:string" /> <wsdl:part name="channel" type="s:string" /> </wsdl:message> <wsdl:message name="SaleConfirmationDetailHttpGetOut"> <wsdl:part name="Body" element="tns:string" /> </wsdl:message> <wsdl:message name="IMEISaleConfirmationHttpGetIn"> <wsdl:part name="RequestId" type="s:string" /> <wsdl:part name="ImeiNo" type="s:string" /> <wsdl:part name="date" type="s:string" /> <wsdl:part name="status" type="s:string" /> <wsdl:part name="skuCode" type="s:string" /> <wsdl:part name="channel" type="s:string" /> </wsdl:message> <wsdl:message name="IMEISaleConfirmationHttpGetOut"> <wsdl:part name="Body" element="tns:string" /> </wsdl:message> <wsdl:message name="SaleConfirmation_NFBCHttpGetIn"> <wsdl:part name="RequestId" type="s:string" /> <wsdl:part name="ImeiNo" type="s:string" /> <wsdl:part name="date" type="s:string" /> <wsdl:part name="status" type="s:string" /> <wsdl:part name="SkuCode" type="s:string" /> <wsdl:part name="ChannelCode" type="s:string" /> </wsdl:message> <wsdl:message name="SaleConfirmation_NFBCHttpGetOut"> <wsdl:part name="Body" element="tns:string" /> </wsdl:message> <wsdl:message name="SaleConfirmationHttpGetIn"> <wsdl:part name="RequestId" type="s:string" /> <wsdl:part name="ImeiNo" type="s:string" /> <wsdl:part name="date" type="s:string" /> <wsdl:part name="status" type="s:string" /> <wsdl:part name="skuCode" type="s:string" /> <wsdl:part name="channel" type="s:string" /> </wsdl:message> <wsdl:message name="SaleConfirmationHttpGetOut"> <wsdl:part name="Body" element="tns:string" /> </wsdl:message> <wsdl:portType name="Service1Soap"> <wsdl:operation name="SaleConfirmationDetail"> <wsdl:input message="tns:SaleConfirmationDetailSoapIn" /> <wsdl:output message="tns:SaleConfirmationDetailSoapOut" /> </wsdl:operation> <wsdl:operation name="IMEISaleConfirmation"> <wsdl:input message="tns:IMEISaleConfirmationSoapIn" /> <wsdl:output message="tns:IMEISaleConfirmationSoapOut" /> </wsdl:operation> <wsdl:operation name="SaleConfirmation_NFBC"> <wsdl:input message="tns:SaleConfirmation_NFBCSoapIn" /> <wsdl:output message="tns:SaleConfirmation_NFBCSoapOut" /> </wsdl:operation> <wsdl:operation name="SaleConfirmation"> <wsdl:input message="tns:SaleConfirmationSoapIn" /> <wsdl:output message="tns:SaleConfirmationSoapOut" /> </wsdl:operation> </wsdl:portType> <wsdl:portType name="Service1HttpGet"> <wsdl:operation name="SaleConfirmationDetail"> <wsdl:input message="tns:SaleConfirmationDetailHttpGetIn" /> <wsdl:output message="tns:SaleConfirmationDetailHttpGetOut" /> </wsdl:operation> <wsdl:operation name="IMEISaleConfirmation"> <wsdl:input message="tns:IMEISaleConfirmationHttpGetIn" /> <wsdl:output message="tns:IMEISaleConfirmationHttpGetOut" /> </wsdl:operation> <wsdl:operation name="SaleConfirmation_NFBC"> <wsdl:input message="tns:SaleConfirmation_NFBCHttpGetIn" /> <wsdl:output message="tns:SaleConfirmation_NFBCHttpGetOut" /> </wsdl:operation> <wsdl:operation name="SaleConfirmation"> <wsdl:input message="tns:SaleConfirmationHttpGetIn" /> <wsdl:output message="tns:SaleConfirmationHttpGetOut" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="Service1Soap" type="tns:Service1Soap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="SaleConfirmationDetail"> <soap:operation soapAction="https://mcs-swa.com/HHP_IMEI_Validation/SaleConfirmationDetail" style="document" /> <wsdl:input> <soap:body use="literal" /> <soap:header message="tns:SaleConfirmationDetailAuthHeader" part="AuthHeader" use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="IMEISaleConfirmation"> <soap:operation soapAction="https://mcs-swa.com/HHP_IMEI_Validation/IMEISaleConfirmation" style="document" /> <wsdl:input> <soap:body use="literal" /> <soap:header message="tns:IMEISaleConfirmationAuthHeader" part="AuthHeader" use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="SaleConfirmation_NFBC"> <soap:operation soapAction="https://mcs-swa.com/HHP_IMEI_Validation/SaleConfirmation_NFBC" style="document" /> <wsdl:input> <soap:body use="literal" /> <soap:header message="tns:SaleConfirmation_NFBCAuthHeader" part="AuthHeader" use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="SaleConfirmation"> <soap:operation soapAction="https://mcs-swa.com/HHP_IMEI_Validation/SaleConfirmation" style="document" /> <wsdl:input> <soap:body use="literal" /> <soap:header message="tns:SaleConfirmationAuthHeader" part="AuthHeader" use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="Service1Soap12" type="tns:Service1Soap"> <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="SaleConfirmationDetail"> <soap12:operation soapAction="https://mcs-swa.com/HHP_IMEI_Validation/SaleConfirmationDetail" style="document" /> <wsdl:input> <soap12:body use="literal" /> <soap12:header message="tns:SaleConfirmationDetailAuthHeader" part="AuthHeader" use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="IMEISaleConfirmation"> <soap12:operation soapAction="https://mcs-swa.com/HHP_IMEI_Validation/IMEISaleConfirmation" style="document" /> <wsdl:input> <soap12:body use="literal" /> <soap12:header message="tns:IMEISaleConfirmationAuthHeader" part="AuthHeader" use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="SaleConfirmation_NFBC"> <soap12:operation soapAction="https://mcs-swa.com/HHP_IMEI_Validation/SaleConfirmation_NFBC" style="document" /> <wsdl:input> <soap12:body use="literal" /> <soap12:header message="tns:SaleConfirmation_NFBCAuthHeader" part="AuthHeader" use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="SaleConfirmation"> <soap12:operation soapAction="https://mcs-swa.com/HHP_IMEI_Validation/SaleConfirmation" style="document" /> <wsdl:input> <soap12:body use="literal" /> <soap12:header message="tns:SaleConfirmationAuthHeader" part="AuthHeader" use="literal" /> </wsdl:input> <wsdl:output> <soap12:body use="literal" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:binding name="Service1HttpGet" type="tns:Service1HttpGet"> <http:binding verb="GET" /> <wsdl:operation name="SaleConfirmationDetail"> <http:operation location="/SaleConfirmationDetail" /> <wsdl:input> <http:urlEncoded /> </wsdl:input> <wsdl:output> <mime:mimeXml part="Body" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="IMEISaleConfirmation"> <http:operation location="/IMEISaleConfirmation" /> <wsdl:input> <http:urlEncoded /> </wsdl:input> <wsdl:output> <mime:mimeXml part="Body" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="SaleConfirmation_NFBC"> <http:operation location="/SaleConfirmation_NFBC" /> <wsdl:input> <http:urlEncoded /> </wsdl:input> <wsdl:output> <mime:mimeXml part="Body" /> </wsdl:output> </wsdl:operation> <wsdl:operation name="SaleConfirmation"> <http:operation location="/SaleConfirmation" /> <wsdl:input> <http:urlEncoded /> </wsdl:input> <wsdl:output> <mime:mimeXml part="Body" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="Service1"> <wsdl:port name="Service1Soap" binding="tns:Service1Soap"> <soap:address location="https://www.mcs-swa.com/HHP_EMI_Validation/service1.asmx" /> </wsdl:port> <wsdl:port name="Service1Soap12" binding="tns:Service1Soap12"> <soap12:address location="https://www.mcs-swa.com/HHP_EMI_Validation/service1.asmx" /> </wsdl:port> <wsdl:port name="Service1HttpGet" binding="tns:Service1HttpGet"> <http:address location="https://www.mcs-swa.com/HHP_EMI_Validation/service1.asmx" /> </wsdl:port> </wsdl:service> </wsdl:definitions>

在eclipse中,我已经从这个WSDL生成了客户端。我必须从 IMEISaleConfirmation 获取输出。但我必须通过AuthHeader用户名/密码进行身份验证。 我的问题是我应该如何使用客户端传递用户名和密码以及IMEISaleConfirmation来获取输出。

0 个答案:

没有答案