我在java中使用JAX-WS使用WCF服务时遇到问题
我必须使用WCF中公开的带有身份验证和ssl的服务。 我使用JAX-wsimport工具生成了客户机。 但当我运行应用程序时,会返回以下错误:我在java中使用JAX-WS使用WCF服务时遇到问题,java,wcf,web-services,soap,jax-ws,Java,Wcf,Web Services,Soap,Jax Ws,我必须使用WCF中公开的带有身份验证和ssl的服务。 我使用JAX-wsimport工具生成了客户机。 但当我运行应用程序时,会返回以下错误: Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: An error occurred when verifying security for the message. at com.sun.xml.internal.ws.fault.SOAP11Fault.getPr
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: An error occurred when verifying security for the message.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy30.solicitarRecarga(Unknown Source)
at postilion.realtime.efecty.ws.test.Test.main(Test.java:113)
这是我的wsdl:
<?xml version="1.0" encoding="utf-8"?><wsdl:definitions name="ServicioRecargas" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsp:Policy wsu:Id="ServicioRecargas_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:TripleDesSha256Rsa15/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SignedSupportingTokens>
<sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
<sp:MustSupportRefIssuerSerial/>
</wsp:Policy>
</sp:Wss10>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd0.xsd" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd1.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd2.xsd" namespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IServicioRecargas_ConsultarRecarga_InputMessage">
<wsdl:part name="parameters" element="tns:ConsultarRecarga"/>
</wsdl:message>
<wsdl:message name="IServicioRecargas_ConsultarRecarga_OutputMessage">
<wsdl:part name="parameters" element="tns:ConsultarRecargaResponse"/>
</wsdl:message>
<wsdl:message name="IServicioRecargas_solicitarRecarga_InputMessage">
<wsdl:part name="parameters" element="tns:solicitarRecarga"/>
</wsdl:message>
<wsdl:message name="IServicioRecargas_solicitarRecarga_OutputMessage">
<wsdl:part name="parameters" element="tns:solicitarRecargaResponse"/>
</wsdl:message>
<wsdl:portType name="IServicioRecargas">
<wsdl:operation name="ConsultarRecarga">
<wsdl:input wsaw:Action="http://tempuri.org/IServicioRecargas/ConsultarRecarga" message="tns:IServicioRecargas_ConsultarRecarga_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IServicioRecargas/ConsultarRecargaResponse" message="tns:IServicioRecargas_ConsultarRecarga_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="solicitarRecarga">
<wsdl:input wsaw:Action="http://tempuri.org/IServicioRecargas/solicitarRecarga" message="tns:IServicioRecargas_solicitarRecarga_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IServicioRecargas/solicitarRecargaResponse" message="tns:IServicioRecargas_solicitarRecarga_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServicioRecargas" type="tns:IServicioRecargas">
<wsp:PolicyReference URI="#ServicioRecargas_policy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ConsultarRecarga">
<soap:operation soapAction="http://tempuri.org/IServicioRecargas/ConsultarRecarga" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="solicitarRecarga">
<soap:operation soapAction="http://tempuri.org/IServicioRecargas/solicitarRecarga" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServicioRecargas">
<wsdl:port name="ServicioRecargas" binding="tns:ServicioRecargas">
<soap:address location="https://SOME_IP:SOME_PORT/ServiciosCajeros/ServicioRecargas.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/">
<xs:import
schemaLocation="ServicioRecargas.svc.xsd_xsd2.xsd"
namespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
<xs:element name="ConsultarRecarga">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="request" nillable="true"
type="q1:RequestConfirmarRecarga"
xmlns:q1="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ConsultarRecargaResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ConsultarRecargaResult"
nillable="true" type="q2:ResponseConfirmarRecarga"
xmlns:q2="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="solicitarRecarga">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="request" nillable="true"
type="q3:RequestRecargarCelular"
xmlns:q3="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="solicitarRecargaResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="solicitarRecargaResult"
nillable="true" type="q4:ResponseRecargarCelular"
xmlns:q4="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType" />
<xs:element name="anyURI" nillable="true" type="xs:anyURI" />
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
<xs:element name="boolean" nillable="true" type="xs:boolean" />
<xs:element name="byte" nillable="true" type="xs:byte" />
<xs:element name="dateTime" nillable="true" type="xs:dateTime" />
<xs:element name="decimal" nillable="true" type="xs:decimal" />
<xs:element name="double" nillable="true" type="xs:double" />
<xs:element name="float" nillable="true" type="xs:float" />
<xs:element name="int" nillable="true" type="xs:int" />
<xs:element name="long" nillable="true" type="xs:long" />
<xs:element name="QName" nillable="true" type="xs:QName" />
<xs:element name="short" nillable="true" type="xs:short" />
<xs:element name="string" nillable="true" type="xs:string" />
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
<xs:element name="char" nillable="true" type="tns:char" />
<xs:simpleType name="char">
<xs:restriction base="xs:int" />
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration" />
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
<xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
<xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid" />
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern
value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName" />
<xs:attribute name="Id" type="xs:ID" />
<xs:attribute name="Ref" type="xs:IDREF" />
</xs:schema>
**and last this is my ServicioRecargas.svc.xsd_xsd2.xsd:**
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified"
targetNamespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts">
<xs:complexType name="RequestConfirmarRecarga">
<xs:sequence>
<xs:element minOccurs="0" name="CodigoPS" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="NombreCajero" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="idTx" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="llaveSesion" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="RequestConfirmarRecarga" nillable="true"
type="tns:RequestConfirmarRecarga" />
<xs:complexType name="ResponseConfirmarRecarga">
<xs:sequence>
<xs:element minOccurs="0" name="codigoMensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="idTx" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="mensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="observaciones" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="ResponseConfirmarRecarga" nillable="true"
type="tns:ResponseConfirmarRecarga" />
<xs:complexType name="RequestRecargarCelular">
<xs:sequence>
<xs:element minOccurs="0" name="Caja" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="CodigoPS" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="CodigoProyectoRecarga"
type="xs:long" />
<xs:element minOccurs="0" name="DescripcionPS" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="NombreCajero" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="NumeroCelular" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="Regional" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="ValorRecarga" type="xs:decimal" />
<xs:element minOccurs="0" name="llaveSesion" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="RequestRecargarCelular" nillable="true"
type="tns:RequestRecargarCelular" />
<xs:complexType name="ResponseRecargarCelular">
<xs:sequence>
<xs:element minOccurs="0" name="IdentificadorTransaccion"
nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="codigoMensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="mensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="observaciones" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="ResponseRecargarCelular" nillable="true"
type="tns:ResponseRecargarCelular" />
</xs:schema>
这是我的ServicioRecargas.svc.xsd_xsd0.xsd:
<?xml version="1.0" encoding="utf-8"?><wsdl:definitions name="ServicioRecargas" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsp:Policy wsu:Id="ServicioRecargas_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:TripleDesSha256Rsa15/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SignedSupportingTokens>
<sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
<sp:MustSupportRefIssuerSerial/>
</wsp:Policy>
</sp:Wss10>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd0.xsd" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd1.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd2.xsd" namespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IServicioRecargas_ConsultarRecarga_InputMessage">
<wsdl:part name="parameters" element="tns:ConsultarRecarga"/>
</wsdl:message>
<wsdl:message name="IServicioRecargas_ConsultarRecarga_OutputMessage">
<wsdl:part name="parameters" element="tns:ConsultarRecargaResponse"/>
</wsdl:message>
<wsdl:message name="IServicioRecargas_solicitarRecarga_InputMessage">
<wsdl:part name="parameters" element="tns:solicitarRecarga"/>
</wsdl:message>
<wsdl:message name="IServicioRecargas_solicitarRecarga_OutputMessage">
<wsdl:part name="parameters" element="tns:solicitarRecargaResponse"/>
</wsdl:message>
<wsdl:portType name="IServicioRecargas">
<wsdl:operation name="ConsultarRecarga">
<wsdl:input wsaw:Action="http://tempuri.org/IServicioRecargas/ConsultarRecarga" message="tns:IServicioRecargas_ConsultarRecarga_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IServicioRecargas/ConsultarRecargaResponse" message="tns:IServicioRecargas_ConsultarRecarga_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="solicitarRecarga">
<wsdl:input wsaw:Action="http://tempuri.org/IServicioRecargas/solicitarRecarga" message="tns:IServicioRecargas_solicitarRecarga_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IServicioRecargas/solicitarRecargaResponse" message="tns:IServicioRecargas_solicitarRecarga_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServicioRecargas" type="tns:IServicioRecargas">
<wsp:PolicyReference URI="#ServicioRecargas_policy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ConsultarRecarga">
<soap:operation soapAction="http://tempuri.org/IServicioRecargas/ConsultarRecarga" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="solicitarRecarga">
<soap:operation soapAction="http://tempuri.org/IServicioRecargas/solicitarRecarga" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServicioRecargas">
<wsdl:port name="ServicioRecargas" binding="tns:ServicioRecargas">
<soap:address location="https://SOME_IP:SOME_PORT/ServiciosCajeros/ServicioRecargas.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/">
<xs:import
schemaLocation="ServicioRecargas.svc.xsd_xsd2.xsd"
namespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
<xs:element name="ConsultarRecarga">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="request" nillable="true"
type="q1:RequestConfirmarRecarga"
xmlns:q1="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ConsultarRecargaResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ConsultarRecargaResult"
nillable="true" type="q2:ResponseConfirmarRecarga"
xmlns:q2="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="solicitarRecarga">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="request" nillable="true"
type="q3:RequestRecargarCelular"
xmlns:q3="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="solicitarRecargaResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="solicitarRecargaResult"
nillable="true" type="q4:ResponseRecargarCelular"
xmlns:q4="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType" />
<xs:element name="anyURI" nillable="true" type="xs:anyURI" />
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
<xs:element name="boolean" nillable="true" type="xs:boolean" />
<xs:element name="byte" nillable="true" type="xs:byte" />
<xs:element name="dateTime" nillable="true" type="xs:dateTime" />
<xs:element name="decimal" nillable="true" type="xs:decimal" />
<xs:element name="double" nillable="true" type="xs:double" />
<xs:element name="float" nillable="true" type="xs:float" />
<xs:element name="int" nillable="true" type="xs:int" />
<xs:element name="long" nillable="true" type="xs:long" />
<xs:element name="QName" nillable="true" type="xs:QName" />
<xs:element name="short" nillable="true" type="xs:short" />
<xs:element name="string" nillable="true" type="xs:string" />
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
<xs:element name="char" nillable="true" type="tns:char" />
<xs:simpleType name="char">
<xs:restriction base="xs:int" />
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration" />
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
<xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
<xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid" />
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern
value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName" />
<xs:attribute name="Id" type="xs:ID" />
<xs:attribute name="Ref" type="xs:IDREF" />
</xs:schema>
**and last this is my ServicioRecargas.svc.xsd_xsd2.xsd:**
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified"
targetNamespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts">
<xs:complexType name="RequestConfirmarRecarga">
<xs:sequence>
<xs:element minOccurs="0" name="CodigoPS" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="NombreCajero" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="idTx" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="llaveSesion" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="RequestConfirmarRecarga" nillable="true"
type="tns:RequestConfirmarRecarga" />
<xs:complexType name="ResponseConfirmarRecarga">
<xs:sequence>
<xs:element minOccurs="0" name="codigoMensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="idTx" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="mensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="observaciones" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="ResponseConfirmarRecarga" nillable="true"
type="tns:ResponseConfirmarRecarga" />
<xs:complexType name="RequestRecargarCelular">
<xs:sequence>
<xs:element minOccurs="0" name="Caja" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="CodigoPS" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="CodigoProyectoRecarga"
type="xs:long" />
<xs:element minOccurs="0" name="DescripcionPS" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="NombreCajero" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="NumeroCelular" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="Regional" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="ValorRecarga" type="xs:decimal" />
<xs:element minOccurs="0" name="llaveSesion" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="RequestRecargarCelular" nillable="true"
type="tns:RequestRecargarCelular" />
<xs:complexType name="ResponseRecargarCelular">
<xs:sequence>
<xs:element minOccurs="0" name="IdentificadorTransaccion"
nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="codigoMensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="mensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="observaciones" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="ResponseRecargarCelular" nillable="true"
type="tns:ResponseRecargarCelular" />
</xs:schema>
这是我的ServicioRecargas.svc.xsd_xsd1.xsd:
<?xml version="1.0" encoding="utf-8"?><wsdl:definitions name="ServicioRecargas" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsp:Policy wsu:Id="ServicioRecargas_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:TripleDesSha256Rsa15/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SignedSupportingTokens>
<sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:MustSupportRefKeyIdentifier/>
<sp:MustSupportRefIssuerSerial/>
</wsp:Policy>
</sp:Wss10>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd0.xsd" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd1.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="ServicioRecargas.svc.xsd_xsd2.xsd" namespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IServicioRecargas_ConsultarRecarga_InputMessage">
<wsdl:part name="parameters" element="tns:ConsultarRecarga"/>
</wsdl:message>
<wsdl:message name="IServicioRecargas_ConsultarRecarga_OutputMessage">
<wsdl:part name="parameters" element="tns:ConsultarRecargaResponse"/>
</wsdl:message>
<wsdl:message name="IServicioRecargas_solicitarRecarga_InputMessage">
<wsdl:part name="parameters" element="tns:solicitarRecarga"/>
</wsdl:message>
<wsdl:message name="IServicioRecargas_solicitarRecarga_OutputMessage">
<wsdl:part name="parameters" element="tns:solicitarRecargaResponse"/>
</wsdl:message>
<wsdl:portType name="IServicioRecargas">
<wsdl:operation name="ConsultarRecarga">
<wsdl:input wsaw:Action="http://tempuri.org/IServicioRecargas/ConsultarRecarga" message="tns:IServicioRecargas_ConsultarRecarga_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IServicioRecargas/ConsultarRecargaResponse" message="tns:IServicioRecargas_ConsultarRecarga_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="solicitarRecarga">
<wsdl:input wsaw:Action="http://tempuri.org/IServicioRecargas/solicitarRecarga" message="tns:IServicioRecargas_solicitarRecarga_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IServicioRecargas/solicitarRecargaResponse" message="tns:IServicioRecargas_solicitarRecarga_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServicioRecargas" type="tns:IServicioRecargas">
<wsp:PolicyReference URI="#ServicioRecargas_policy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="ConsultarRecarga">
<soap:operation soapAction="http://tempuri.org/IServicioRecargas/ConsultarRecarga" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="solicitarRecarga">
<soap:operation soapAction="http://tempuri.org/IServicioRecargas/solicitarRecarga" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServicioRecargas">
<wsdl:port name="ServicioRecargas" binding="tns:ServicioRecargas">
<soap:address location="https://SOME_IP:SOME_PORT/ServiciosCajeros/ServicioRecargas.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/">
<xs:import
schemaLocation="ServicioRecargas.svc.xsd_xsd2.xsd"
namespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
<xs:element name="ConsultarRecarga">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="request" nillable="true"
type="q1:RequestConfirmarRecarga"
xmlns:q1="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ConsultarRecargaResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="ConsultarRecargaResult"
nillable="true" type="q2:ResponseConfirmarRecarga"
xmlns:q2="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="solicitarRecarga">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="request" nillable="true"
type="q3:RequestRecargarCelular"
xmlns:q3="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="solicitarRecargaResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="solicitarRecargaResult"
nillable="true" type="q4:ResponseRecargarCelular"
xmlns:q4="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/">
<xs:element name="anyType" nillable="true" type="xs:anyType" />
<xs:element name="anyURI" nillable="true" type="xs:anyURI" />
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary" />
<xs:element name="boolean" nillable="true" type="xs:boolean" />
<xs:element name="byte" nillable="true" type="xs:byte" />
<xs:element name="dateTime" nillable="true" type="xs:dateTime" />
<xs:element name="decimal" nillable="true" type="xs:decimal" />
<xs:element name="double" nillable="true" type="xs:double" />
<xs:element name="float" nillable="true" type="xs:float" />
<xs:element name="int" nillable="true" type="xs:int" />
<xs:element name="long" nillable="true" type="xs:long" />
<xs:element name="QName" nillable="true" type="xs:QName" />
<xs:element name="short" nillable="true" type="xs:short" />
<xs:element name="string" nillable="true" type="xs:string" />
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte" />
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt" />
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong" />
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort" />
<xs:element name="char" nillable="true" type="tns:char" />
<xs:simpleType name="char">
<xs:restriction base="xs:int" />
</xs:simpleType>
<xs:element name="duration" nillable="true" type="tns:duration" />
<xs:simpleType name="duration">
<xs:restriction base="xs:duration">
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?" />
<xs:minInclusive value="-P10675199DT2H48M5.4775808S" />
<xs:maxInclusive value="P10675199DT2H48M5.4775807S" />
</xs:restriction>
</xs:simpleType>
<xs:element name="guid" nillable="true" type="tns:guid" />
<xs:simpleType name="guid">
<xs:restriction base="xs:string">
<xs:pattern
value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}" />
</xs:restriction>
</xs:simpleType>
<xs:attribute name="FactoryType" type="xs:QName" />
<xs:attribute name="Id" type="xs:ID" />
<xs:attribute name="Ref" type="xs:IDREF" />
</xs:schema>
**and last this is my ServicioRecargas.svc.xsd_xsd2.xsd:**
<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified"
targetNamespace="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://schemas.datacontract.org/2004/07/Efecty.ServiciosSOA.SOARecargas.DataContracts">
<xs:complexType name="RequestConfirmarRecarga">
<xs:sequence>
<xs:element minOccurs="0" name="CodigoPS" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="NombreCajero" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="idTx" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="llaveSesion" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="RequestConfirmarRecarga" nillable="true"
type="tns:RequestConfirmarRecarga" />
<xs:complexType name="ResponseConfirmarRecarga">
<xs:sequence>
<xs:element minOccurs="0" name="codigoMensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="idTx" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="mensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="observaciones" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="ResponseConfirmarRecarga" nillable="true"
type="tns:ResponseConfirmarRecarga" />
<xs:complexType name="RequestRecargarCelular">
<xs:sequence>
<xs:element minOccurs="0" name="Caja" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="CodigoPS" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="CodigoProyectoRecarga"
type="xs:long" />
<xs:element minOccurs="0" name="DescripcionPS" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="NombreCajero" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="NumeroCelular" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="Regional" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="ValorRecarga" type="xs:decimal" />
<xs:element minOccurs="0" name="llaveSesion" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="RequestRecargarCelular" nillable="true"
type="tns:RequestRecargarCelular" />
<xs:complexType name="ResponseRecargarCelular">
<xs:sequence>
<xs:element minOccurs="0" name="IdentificadorTransaccion"
nillable="true" type="xs:string" />
<xs:element minOccurs="0" name="codigoMensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="mensaje" nillable="true"
type="xs:string" />
<xs:element minOccurs="0" name="observaciones" nillable="true"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:element name="ResponseRecargarCelular" nillable="true"
type="tns:ResponseRecargarCelular" />
</xs:schema>
**最后这是我的ServicioRecargas.svc.xsd_xsd2.xsd:**
有了这些文件,我可以使用JAX-WS生成我的类wsimport工具
public class Test {
static {
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier()
{
@Override
public boolean verify(String hostname, SSLSession session)
{
if (hostname.equals("SOME_IP"))
return true;
return false;
}
});
}
/**
* @param args
* @throws MalformedURLException
*/
public static void main(String[] args) throws MalformedURLException {
String trustStore = System.getProperty("javax.net.ssl.trustStore");
System.setProperty("javax.net.ssl.trustStore", "C:\\Users\\ggomezb\\Desktop\\WS_Efecty_ADB\\config\\jks\\efecty.jks");
trustStore = System.getProperty("javax.net.ssl.trustStorePassword");
System.setProperty("javax.net.ssl.trustStorePassword", "123456");
IServicioRecargas service;
URL wsUrl = new URL("https://SOME_IP:SOME_PORT/ServiciosCajeros/ServicioRecargas.svc");
QName wsQName = new QName("http://tempuri.org/", "ServicioRecargas");
ServicioRecargas impl = new ServicioRecargas(wsUrl, wsQName);
service = impl.getServicioRecargas();
//BindingProvider bindingProvider = (BindingProvider) service;
//bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsUrl.toString());
//bindingProvider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "usuarioCajeros");
//bindingProvider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "5wx1YCbTgckA+bg3mxsFlTTtunPbmgFIr2AHzHIq/1jmxHjh51A0m6moTPL0oCH0Q6WhiDyBGDHAPtPlepbk+Q==");
Map<String, Object> req_ctx = ((BindingProvider)service).getRequestContext();
req_ctx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsUrl.toString());
Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("Username", Collections.singletonList("usuarioCajeros"));
headers.put("Password", Collections.singletonList("5wx1YCbTgckA+bg3mxsFlTTtunPbmgFIr2AHzHIq/1jmxHjh51A0m6moTPL0oCH0Q6WhiDyBGDHAPtPlepbk+Q=="));
req_ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
SolicitarRecarga solicitarRecarga = new SolicitarRecarga();
RequestRecargarCelular requestRecargarCelular = new RequestRecargarCelular();
ObjectFactory factory = new ObjectFactory();
JAXBElement<String> createLlaveSesion = factory.createRequestRecargarCelularLlaveSesion("c8ffe140-8dc3-413f-a469-a359f45ef0a1");
JAXBElement<String> createCodigoPS = factory.createRequestRecargarCelularCodigoPS("010010");
JAXBElement<String> createDescripcionPS = factory.createRequestRecargarCelularDescripcionPS("prueba");
JAXBElement<String> createNombreCajero = factory.createRequestRecargarCelularNombreCajero("epardo");
JAXBElement<String> createCaja = factory.createRequestRecargarCelularCaja("1");
long codigoProyectoRegional = 110145;
JAXBElement<String> createRegional = factory.createRequestRecargarCelularRegional("1");
JAXBElement<String> createNumeroCelular = factory.createRequestRecargarCelularNumeroCelular("3118027200");
BigDecimal valorRecarga = new BigDecimal(10000);
requestRecargarCelular.setLlaveSesion(createLlaveSesion);
requestRecargarCelular.setCodigoPS(createCodigoPS);
requestRecargarCelular.setDescripcionPS(createDescripcionPS);
requestRecargarCelular.setNombreCajero(createNombreCajero);
requestRecargarCelular.setCaja(createCaja);
requestRecargarCelular.setCodigoProyectoRecarga(codigoProyectoRegional);
requestRecargarCelular.setRegional(createRegional);
requestRecargarCelular.setNumeroCelular(createNumeroCelular);
requestRecargarCelular.setValorRecarga(valorRecarga);
JAXBElement<RequestRecargarCelular> requestConfirmarRecargaJAXB = factory.createRequestRecargarCelular(requestRecargarCelular);
solicitarRecarga.setRequest(requestConfirmarRecargaJAXB);
JAXBElement<RequestRecargarCelular> requestRecargarCelularJAXB = solicitarRecarga.getRequest();
requestRecargarCelular = requestRecargarCelularJAXB.getValue();
SolicitarRecargaResponse rta = new SolicitarRecargaResponse();
ResponseRecargarCelular responseRecargarCelular = service.solicitarRecarga(requestRecargarCelular);
System.out.println(responseRecargarCelular.getCodigoMensaje());
}
}
公共类测试{
静止的{
HttpsURLConnection.setDefaultHostnameVerifier(新的HostnameVerifier()
{
@凌驾
公共布尔验证(字符串主机名、SSLSession会话)
{
if(hostname.equals(“某些IP”))
返回true;
返回false;
}
});
}
/**
*@param args
*@抛出错误的DurException
*/
publicstaticvoidmain(字符串[]args)引发畸形的DurLexException{
字符串trustStore=System.getProperty(“javax.net.ssl.trustStore”);
System.setProperty(“javax.net.ssl.trustStore”,“C:\\Users\\ggomezb\\Desktop\\WS\u Efecty\u ADB\\config\\jks\\Efecty.jks”);
trustStore=System.getProperty(“javax.net.ssl.trustStorePassword”);
setProperty(“javax.net.ssl.trustStorePassword”、“123456”);
IServicioRecargas服务;
URL wsUrl=新URL(“https://SOME_IP:SOME_PORT/ServiciosCajeros/ServicioRecargas.svc");
QName wsQName=新的QName(“http://tempuri.org/“,“ServicioRecargas”);
ServicioRecargas impl=新的ServicioRecargas(wsUrl,wsQName);
service=impl.getServicioRecargas();
//BindingProvider BindingProvider=(BindingProvider)服务;
//bindingProvider.getRequestContext().put(bindingProvider.ENDPOINT_ADDRESS_属性,wsUrl.toString());
//bindingProvider.getRequestContext().put(bindingProvider.USERNAME_属性,“usuarioCajeros”);
//bindingProvider.getRequestContext().put(bindingProvider.PASSWORD_属性,“5wx1YCbTgckA+bg3mxsFlTTtunPbmgFIr2AHzHIq/1jmxHjh51A0m6moTPL0oCH0Q6WhiDyBGDHAPtPlepbk+Q=”;
Map req_ctx=((BindingProvider)服务).getRequestContext();
req_ctx.put(BindingProvider.ENDPOINT_ADDRESS_属性,wsUrl.toString());
Map headers=newhashmap();
headers.put(“用户名”,Collections.singletonList(“usuarioCajeros”);
headers.put(“密码”,Collections.singletonList(“5wx1YCbTgckA+bg3mxsFlTTtunPbmgFIr2AHzHIq/1jmxHjh51A0m6moTPL0oCH0Q6WhiDyBGDHAPtPlepbk+Q=”);
req_ctx.put(MessageContext.HTTP_请求_头,头);
requestarrecarga requestarrecarga=新的requestarrecarga();
requestRecargerceLular requestRecargerceLular=新requestRecargerceLular();
ObjectFactory=新的ObjectFactory();
JAXBElement createLlaveSesion=factory.createRequestRecargerceLularLaveSession(“c8ffe140-8dc3-413f-a469-a359f45ef0a1”);
JAXBElement createCodigoPS=factory.createRequestRecargerceLularCodigops(“010010”);
JAXBElement createDescriptionps=factory.createRequestRecargerceLulardScriptionps(“prueba”);
JAXBElement createNombreCajero=factory.createRequestRecargarcellularnombrecajero(“epardo”);
JAXBElement createCaja=factory.createRequestRecargarCelularCaja(“1”);
长编码区=110145;
JAX