使用eclipse在java中使用SOAP webservice

时间:2018-01-08 12:26:13

标签: java eclipse soap soapui soap-client

我正在尝试从我创建的wsdl链接中使用web服务并测试SOAP UI软件中的链接,它运行正常。

但是,当我在eclipse中测试得到一个无效\过期的令牌,而调试时却知道" key"需要传递标题信息中可用的内容。

任何人都可以在从webservice检索数据时帮助如何绑定SOAP头信息。

这是我的wsdl定义:

<?xml version="1.0" encoding="UTF-8" ?> 
 <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/services/TSProvider" xmlns:intf="http://localhost:8080/axis/services/TSProvider" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost:8080/axis/services/TSProvider">
  <wsdl:types>
 <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost:8080/axis/services/TSProvider">
  <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
 <complexType name="ArrayOf_xsd_int">
 <complexContent>
 <restriction base="soapenc:Array">
  <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]" /> 
  </restriction>
  </complexContent>
  </complexType>
 <complexType name="ArrayOfArrayOf_soapenc_string">
 <complexContent>
 <restriction base="soapenc:Array">
  <attribute ref="soapenc:arrayType" wsdl:arrayType="soapenc:string[][]" /> 
  </restriction>
  </complexContent>
  </complexType>
 <complexType name="HeaderInfo">
 <sequence>
  <element name="LoginToken" type="xsd:string" /> 
  </sequence>
  </complexType>
  </schema>
  </wsdl:types>
 <wsdl:message name="HeaderInfoMsg">
  <wsdl:part name="HeaderInfoPart" type="impl:HeaderInfo" /> 
  </wsdl:message>
 <wsdl:message name="loadTimesheetDataResponse">
  <wsdl:part name="loadTimesheetDataReturn" type="soapenc:string" /> 
  </wsdl:message>
 <wsdl:message name="loadTimesheetDataRequest">
  <wsdl:part name="a_psNo" type="soapenc:string" /> 
  <wsdl:part name="a_weekStartDate" type="soapenc:string" /> 
  </wsdl:message>
 <wsdl:operation name="loadTimesheetData" parameterOrder="a_psNo a_weekStartDate">
  <wsdl:input message="impl:loadTimesheetDataRequest" name="loadTimesheetDataRequest" /> 
  <wsdl:output message="impl:loadTimesheetDataResponse" name="loadTimesheetDataResponse" /> 
  </wsdl:operation>
  </wsdl:portType>
 <wsdl:binding name="TSProviderSoapBinding" type="impl:TSProvider">
  <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> 
 <wsdl:operation name="loadTimesheetData">
  <wsdlsoap:operation soapAction="" /> 
 <wsdl:input name="loadTimesheetDataRequest">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservice.servicecomp.arun.com" use="encoded" /> 
  <wsdlsoap:header encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservice.servicecomp.arun.com" use="encoded" message="impl:HeaderInfoMsg" part="HeaderInfoPart" /> 
  </wsdl:input>
 <wsdl:output name="loadTimesheetDataResponse">
  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/TSProvider" use="encoded" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
 <wsdl:service name="TSProviderService">
 <wsdl:port binding="impl:TSProviderSoapBinding" name="TSProvider">
  <wsdlsoap:address location="http://localhost:8080/axis/services/TSProvider" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>

提前致谢。

0 个答案:

没有答案