微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

WSDL

关于WSDL
WSDL一般要和AXIS配合来使用。来生成WSDL jar包
我们引入wsdl jar包,使用生成jar包中的各种class类

一般要生成WSDL jar包,要使用WSDL配合AXIS来生成
jar包就提供多个.class类,这些多个.class类就对应着原来的WSDL xml中的各个元素

我们如果要发消息收读消息,就要涉及到两层
第一,数据的来源
  数据可能来源于框架本身,框架收集用户输入的数据,用户输入的数据可能通过ActiveCardRequest等被传输进来之后
  那么ActiveCardAgent类(该类中有发消息等的方法)中的方法就可以拿ActiveCardRequest中的数据
 
 
              
            listofDocument listofCitiCardForCustomerInqRqDocument = listofRqDocument.Factory.newInstance();
            listofRq listofCitiCardForCustomerInq = listofRqDocument.addNewCardForCustomerInqRq();
            Custom  customerKey=listofCitiCardForCustomerInq.addNewCustomerKey();
           由上到下,不断的通过层的递进方式来塞数据(塞数据的过程包含着java类的创建0),最终的结果就是,每一层的元素都会被一个java类代表。
            通过一层一层的方式就可以把数据塞进来
            要注意的是WSDL JAR被生成出来的时候,会包含很多的java bean,这些java bean就会包含wsdl xml 中的每一层元素
           
           框架把获取到的数据塞到由WSDL生成的java 类中。
           框架再通过
           
           最终通过XML形式将数据发送出去。返回一个response.
           
           
           
           遗留问题:agent类从哪来,是否在wsdl jar包中。
           最后到底是发request,还是发其他的
           消息最终是从哪里过来的。

http://wenku.baidu.com/view/d5140cea81c758f5f61f67c4.html 百度文库关于WSDL

百度搜索引擎技术:

http://topic.csdn.net/u/20110218/16/c2789421-b3da-4466-870c-8adae2c8771d.html

http://wenku.baidu.com/view/332753c66137ee06eff9182d.html?from=rec&pos=2&weight=143&lastweight=126&count=5

a

axis+webservice



 a

axis2WebService

http://wenku.baidu.com/view/12501ed7195f312b3169a54b.html?from=rec&pos=0&weight=322&lastweight=126&count=5


如何生成wsdl 包

http://wenku.baidu.com/view/3d86561910a6f524ccbf8568.html


http://book.51cto.com/art/200911/163639.htm



WEB服务建模,生成WSDL jar包

http://www.cnblogs.com/mingzi/archive/2009/03/09/1406969.html


listofCardForCustomerInqRqDocument listofCardForCustomerInqRqDocument = listofCardForCustomerInqRqDocument.Factory.newInstance();
            listofCardForCustomerInqRq listofCardForCustomerInq = listofCardForCustomerInqRqDocument.addNewlistofCardForCustomerInqRq();
            CustomerKey customerKey=listofCardForCustomerInq.addNewCustomerKey();
            customerKey.setCustomerNo(getCustomerNumber(message));
            listofCardForCustomerInq.setCustomerKey(customerKey);
            CustomerGenericServiceStub stub = (CustomerGenericServiceStub) JFPbeanfactory.getBean("CustomerGenericService");
            RqHeaderDocument headerDoc = RqHeaderDocument.Factory.newInstance();
            RqHeader header = headerDoc.addNewRqHeader();
            DenormalizerHelper.populateTIBCOHeader(header,getIssuerBusinessUnit(),"listofCitiCardForCustomerInq");
            
            listofCardForCustomerInqRsDocument listofCardForCustomerInqRsDocument = stub.listofCardForCustomerInq(listofCardForCustomerInqRqDocument,headerDoc);
            listofCardForCustomerInqRs rs = listofCardForCustomerInqRsDocument.getlistofCardForCustomerInqRs();



===================================================webservice实例=====================

http://www.iteye.com/problems/69381



是这样的,我参考http://www.ibm.com/developerworks/cn/xml/x-jaxmsoap/中的示例,进行测试,由于示例中的WebService不能用,我自己用myEclipse中的JAX-WS框架创建了一个简单的WebService——myFirstWS,myFirstWS对外提供一个sayHello(String name)方法,这个方法返回name+",this is my first Jaxws!".     当客户端调用时,当传入的name为中文的时候,在服务器端接受到的参数很正常,不出现乱码,但是返回到客户端的消息中就会出现乱码。具体代码如下: import javax.xml.soap.MessageFactory; import javax.xml.soap.soAPBody; import javax.xml.soap.soAPConnection; import javax.xml.soap.soAPConnectionFactory; import javax.xml.soap.soAPElement; import javax.xml.soap.soAPEnvelope; import javax.xml.soap.soAPMessage; import javax.xml.soap.soAPPart; import javax.xml.transform.source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; public class SOAPTip { public static void main(String args[]) { try { // First create the connection SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance(); SOAPConnection connection = soapConnFactory.createConnection(); //Next,create the actual message          MessageFactory messageFactory = MessageFactory.newInstance();          SOAPMessage message = messageFactory.createMessage();                  message.setProperty(SOAPMessage.CHaraCTER_SET_ENCODING,"gb2312");          SOAPPart soapPart = message.getSOAPPart();                   //Create objects for the message parts                     SOAPEnvelope envelope = soapPart.getEnvelope();          SOAPBody body = envelope.getBody();                  //Populate the body          //Create the main element and namespace          SOAPElement bodyElement = body.addChildElement(envelope.createName("sayHello","ns1","http://jaxws.shaw.com/"));                   //Add content          String city = "北京";          bodyElement.addChildElement("arg0").addTextNode(city);                   //Save the message          message.saveChanges();                   //Check the input          System.out.println("\\nREQUEST:\\n");          message.writeto(System.out);          System.out.println();                   //Send the message and get a reply                        //Set the destination          String destination = "http://localhost:8080/myFirstWS/HelloJaxwsPort?wsdl";          //Send the message          SOAPMessage reply = connection.call(message,destination);          //Check the output          System.out.println("\\nRESPONSE:\\n");          //Create the transformer          TransformerFactory transformerFactory = TransformerFactory.newInstance();          Transformer transformer = transformerFactory.newTransformer();          //Extract the content of the reply          Source sourceContent = reply.getSOAPPart().getContent();                   //Set the output for the transformation          StreamResult result = new StreamResult(System.out);          transformer.transform(sourceContent,result);          System.out.println();          // Close the connection connection.close(); } catch (Exception e) { System.out.println(e.getMessage()); } } }      上面的程序传入的name为“北京”,运行之后,客户端接收到如下消息: <?xml version="1.0" encoding="UTF-8" standalone="no"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:sayHelloResponse xmlns:ns2="http://jaxws.shaw.com/"><return>鍖椾含,this is my first Jaxws!</return></ns2:sayHelloResponse></S:Body></S:Envelope>      请各位帮忙看一下问题出在什么地方?谢谢。      另外,myFirstWS的wsdl和xsd文档如下: wsdl:   <?xml version="1.0" encoding="UTF-8" ?> - <!--  Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.1-b01-.   --> - <!--  Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.1-b01-.   --> - <deFinitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/Metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://jaxws.shaw.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://jaxws.shaw.com/" name="HelloJaxwsService"> - <types> - <xsd:schema>   <xsd:import namespace="http://jaxws.shaw.com/" schemaLocation="http://localhost:8080/myFirstWS/HelloJaxwsPort?xsd=1" />   </xsd:schema>   </types> - <message name="add">   <part name="parameters" element="tns:add" />   </message> - <message name="addResponse">   <part name="parameters" element="tns:addResponse" />   </message> - <message name="sayHello">   <part name="parameters" element="tns:sayHello" />   </message> - <message name="sayHelloResponse">   <part name="parameters" element="tns:sayHelloResponse" />   </message> - <portType name="HelloJaxwsDelegate"> - <operation name="add">   <input wsam:Action="http://jaxws.shaw.com/HelloJaxwsDelegate/addRequest" message="tns:add" />   <output wsam:Action="http://jaxws.shaw.com/HelloJaxwsDelegate/addResponse" message="tns:addResponse" />   </operation> - <operation name="sayHello">   <input wsam:Action="http://jaxws.shaw.com/HelloJaxwsDelegate/sayHelloRequest" message="tns:sayHello" />   <output wsam:Action="http://jaxws.shaw.com/HelloJaxwsDelegate/sayHelloResponse" message="tns:sayHelloResponse" />   </operation>   </portType> - <binding name="HelloJaxwsPortBinding" type="tns:HelloJaxwsDelegate">   <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> - <operation name="add">   <soap:operation soapAction="" /> - <input>   <soap:body use="literal" />   </input> - <output>   <soap:body use="literal" />   </output>   </operation> - <operation name="sayHello">   <soap:operation soapAction="" /> - <input>   <soap:body use="literal" />   </input> - <output>   <soap:body use="literal" />   </output>   </operation>   </binding> - <service name="HelloJaxwsService"> - <port name="HelloJaxwsPort" binding="tns:HelloJaxwsPortBinding">   <soap:address location="http://localhost:8080/myFirstWS/HelloJaxwsPort" />   </port>   </service>   </deFinitions> xsd:   <?xml version="1.0" encoding="UTF-8" ?> - <!--  Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.1-b01-.   --> - <xs:schema xmlns:tns="http://jaxws.shaw.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://jaxws.shaw.com/">   <xs:element name="add" type="tns:add" />   <xs:element name="addResponse" type="tns:addResponse" />   <xs:element name="sayHello" type="tns:sayHello" />   <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" /> - <xs:complexType name="sayHello"> - <xs:sequence>   <xs:element name="arg0" type="xs:string" minOccurs="0" />   </xs:sequence>   </xs:complexType> - <xs:complexType name="sayHelloResponse"> - <xs:sequence>   <xs:element name="return" type="xs:string" minOccurs="0" />   </xs:sequence>   </xs:complexType> - <xs:complexType name="add"> - <xs:sequence>   <xs:element name="arg0" type="xs:int" />   <xs:element name="arg1" type="xs:int" />   </xs:sequence>   </xs:complexType> - <xs:complexType name="addResponse"> - <xs:sequence>   <xs:element name="return" type="xs:int" />   </xs:sequence>   </xs:complexType>   </xs:schema>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐