访问wsdl的接口

来源:互联网 发布:情义我心知国语版 编辑:程序博客网 时间:2024/05/19 17:03

访问wsdl文件的接口

1.http://10.62.226.150:10000/esb/webservice/Jizhandabiao?wsdl 文件内容

  <?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions name="JizhandabiaoImplService" targetNamespace="http://webservice.rpc.other.web.demo.g4studio.org/" xmlns:ns1="http://cxf.apache.org/bindings/xformat" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservice.rpc.other.web.demo.g4studio.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-<wsdl:types>
-<xs:schema elementFormDefault="unqualified" targetNamespace="http://webservice.rpc.other.web.demo.g4studio.org/" version="1.0" xmlns:tns="http://webservice.rpc.other.web.demo.g4studio.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="IsAlive" type="tns:IsAlive" />
  <xs:element name="IsAliveResponse" type="tns:IsAliveResponse" />
  <xs:element name="createsite" type="tns:createsite" />
  <xs:element name="createsiteResponse" type="tns:createsiteResponse" />
-<xs:complexType name="IsAlive">
  <xs:sequence />
  </xs:complexType>
-<xs:complexType name="IsAliveResponse">
-<xs:sequence>
  <xs:element minOccurs="0" name="return" type="xs:string" />
  </xs:sequence>
  </xs:complexType>
-<xs:complexType name="createsite">
-<xs:sequence>
  <xs:element form="qualified" minOccurs="0" name="xmlContent" type="xs:string" />
  </xs:sequence>
  </xs:complexType>
-<xs:complexType name="createsiteResponse">
-<xs:sequence>
  <xs:element minOccurs="0" name="return" type="xs:string" />
  </xs:sequence>
  </xs:complexType>
  </xs:schema>
  </wsdl:types>
-<wsdl:message name="IsAlive">
  <wsdl:part element="tns:IsAlive" name="parameters" />
  </wsdl:message>
-<wsdl:message name="IsAliveResponse">
  <wsdl:part element="tns:IsAliveResponse" name="parameters" />
  </wsdl:message>
-<wsdl:message name="createsiteResponse">
  <wsdl:part element="tns:createsiteResponse" name="parameters" />
  </wsdl:message>
-<wsdl:message name="createsite">
  <wsdl:part element="tns:createsite" name="parameters" />
  </wsdl:message>
-<wsdl:portType name="Jizhandabiao">
-<wsdl:operation name="IsAlive">
  <wsdl:input message="tns:IsAlive" name="IsAlive" />
  <wsdl:output message="tns:IsAliveResponse" name="IsAliveResponse" />
  </wsdl:operation>
-<wsdl:operation name="createsite">
  <wsdl:input message="tns:createsite" name="createsite" />
  <wsdl:output message="tns:createsiteResponse" name="createsiteResponse" />
  </wsdl:operation>
  </wsdl:portType>
-<wsdl:binding name="JizhandabiaoImplServiceSoapBinding" type="tns:Jizhandabiao">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
-<wsdl:operation name="IsAlive">
  <soap:operation soapAction="" style="document" />
-<wsdl:input name="IsAlive">
  <soap:body use="literal" />
  </wsdl:input>
-<wsdl:output name="IsAliveResponse">
  <soap:body use="literal" />
  </wsdl:output>
  </wsdl:operation>
-<wsdl:operation name="createsite">
  <soap:operation soapAction="" style="document" />
-<wsdl:input name="createsite">
  <soap:body use="literal" />
  </wsdl:input>
-<wsdl:output name="createsiteResponse">
  <soap:body use="literal" />
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
-<wsdl:service name="JizhandabiaoImplService">
-<wsdl:port binding="tns:JizhandabiaoImplServiceSoapBinding" name="JizhandabiaoImplPort">
  <soap:address location="http://10.62.226.150:10000/esb/webservice/Jizhandabiao" />
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>

2.测试访问里面createsite接口

/*public static void main(String[] args) throws Exception {

 
String xml="<?xml version=\"1.0\" encoding=\"utf-8\"?>"+
"<root>" +
"<basestation_id>99999999199892483</basestation_id>" +
"<basestation_name>test增加</basestation_name>" +
"<enodebID>109597</enodebID> " +
"<bsc>0</bsc>" +
"<btsid>1113848</btsid>" +
"<type>4G</type>" +
 
"</root> ";
 
String url = "http://10.62.226.150:10000/esb/webservice/Jizhandabiao?wsdl";
Service serv = new Service();
Call call = (Call) serv.createCall();
call.setTargetEndpointAddress(url);
call.setOperationName(new QName("http://webservice.rpc.other.web.demo.g4studio.org/","createsite"));
call.addParameter(new QName("http://webservice.rpc.other.web.demo.g4studio.org/", "xmlContent"), XMLType.XSD_STRING, Class.forName("java.lang.String"), ParameterMode.IN );
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
System.out.println("推送的xml---"+xml);
String str=(String) call.invoke(new Object[] {xml});
System.out.println(str+"----------------推送成功");
}*/
原创粉丝点击