{"rsdb":{"rid":"244657","subhead":"","postdate":"0","aid":"168343","fid":"76","uid":"1","topic":"1","content":"
\n
\n \u539f\u6587\u51fa\u5904\uff1a \n \u8881\u9e23\u51ef<\/a>\n <\/div> \n

\u4e00\u3001SOAPIn Axis2<\/h1> \n

\u5728\u524d\u4e24\u5929\u7684\u6559\u7a0b\u4e2d,\u6211\u4eec\u5b66\u4e60\u5230\u4e86\u7528Axis2\u5982\u4f55\u8fdb\u884c\u590d\u6742\u6570\u636e\u3001\u7b80\u5355\u6570\u636e\u8fdb\u884c\u4f20\u8f93\u3002<\/p> \n

\u6b63\u5982\u6211\u5728\u524d\u4e00\u5929\u6559\u7a0b\u4e2d\u6240\u8bf4\uff0c\u5728web service\u7684\u4e16\u754c\u91cc\uff0c\u4e00\u5207\u90fd\u662f\u57fa\u4e8eSOAP\u7684\uff0c\u56e0\u6b64\u5728\u4eca\u5929\u6211\u4eec\u5c06\u5b66\u4e60Axis2\u4e2d\u7684SOAP\u7279\u6027\u3002<\/p> \n

\u4eca\u5929\u7684\u8bfe\u7a0b\u5c06\u75283\u4e2a\u4f8b\u5b50\u6765\u5b8c\u6210\u5373\uff1a<\/p> \n

    \n
  1. \u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u4f7f\u7528SOAP\u8fdb\u884c\u901a\u8baf<\/li> \n
  2. \u670d\u52a1\u7aef\u5c06Exception\u4ee5SOAPFault\u7684\u5f62\u5f0f\u629b\u7ed9\u5ba2\u6237\u7aef<\/li> \n
  3. \u4f7f\u7528SWA\uff08Soap With Attachment\uff09\u6765\u8fdb\u884c\u9644\u4ef6\u4f20\u9001<\/li> \n <\/ol> \n

    \u4e8c\u3001\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u4f7f\u7528SOAP\u8fdb\u884c\u901a\u8baf<\/h1> \n

    \u6765\u770b\u4e0b\u9762\u8fd9\u4e2aWeb Service\uff1a<\/p> \n

    \"\"<\/p> \n

     <\/p> \n

    \u4e0b\u9762\u662fService\u7aef\u7684\u6e90\u7801<\/p> \n

    org.sky.axis2.soap.SoapService<\/p> \n

    package org.sky.axis2.soap;\r\n\r\n \r\n\r\nimport org.apache.axiom.om.OMAbstractFactory;\r\n\r\nimport org.apache.axiom.om.OMElement;\r\n\r\nimport org.apache.axiom.om.OMFactory;\r\n\r\nimport org.apache.axiom.om.OMNamespace;\r\n\r\nimport java<\/a>.util.*;\r\n\r\n \r\n\r\npublic class SoapService {\r\n\r\n \r\n\r\n         public static OMElement requestSoap = null;\r\n\r\n \r\n\r\n         public OMElement request(OMElement soapBody) {\r\n\r\n                   requestSoap = soapBody;\r\n\r\n \r\n\r\n                   Iterator it = requestSoap.getChildElements();\r\n\r\n                   OMElement issuerElement = (OMElement) it.next();\r\n\r\n                   OMElement serialElement = (OMElement) it.next();\r\n\r\n                   OMElement revocationDateElement = (OMElement) it.next();\r\n\r\n \r\n\r\n                   String issuer = issuerElement.getText();\r\n\r\n                   String serial = serialElement.getText();\r\n\r\n                   String revocationDate = revocationDateElement.getText();\r\n\r\n                   System.out.println("issuer=====" + issuer);\r\n\r\n                   System.out.println("serial=====" + serial);\r\n\r\n                   System.out.println("revocationDate=====" + revocationDate);\r\n\r\n                   OMFactory soapFactory = OMAbstractFactory.getOMFactory();\r\n\r\n                   OMNamespace omNs = soapFactory.createOMNamespace(\r\n\r\n                                     "http:\/\/soap.axis2.sky.org", "");\r\n\r\n                   OMElement soapResponse = soapFactory.createOMElement("SoapResponse",\r\n\r\n                                     omNs);\r\n\r\n \r\n\r\n                   OMElement soapIssuer = soapFactory.createOMElement("Issuer", omNs);\r\n\r\n                   soapIssuer.setText("issuer: " + issuer);\r\n\r\n                   soapResponse.addChild(soapIssuer);\r\n\r\n \r\n\r\n                   OMElement soapSerial = soapFactory.createOMElement("Serial", omNs);\r\n\r\n                   soapSerial.setText("serial: " + serial);\r\n\r\n                   soapResponse.addChild(soapSerial);\r\n\r\n \r\n\r\n                   OMElement soapRevokeDate = soapFactory.createOMElement("RevokeDate",\r\n\r\n                                     omNs);\r\n\r\n                   soapRevokeDate.setText("RevocationDate: " + revocationDate);\r\n\r\n                   soapResponse.addChild(soapRevokeDate);\r\n\r\n                   soapResponse.build();\r\n\r\n \r\n\r\n                   return soapResponse;\r\n\r\n         }\r\n\r\n \r\n\r\n}<\/pre> \n 

    \"\"\u6765\u770b\u5b83\u7684service.xml\u7684\u63cf\u8ff0<\/p> \n

    \r\n<service name="SoapService">\r\n\r\n         <description>\r\n\r\n                   This is the service for revoking certificate.\r\n\r\n         <\/description>\r\n\r\n         <parameter name="ServiceClass" locked="false">\r\n\r\n                   org.sky.axis2.soap.SoapService\r\n\r\n         <\/parameter>\r\n\r\n         <operation name="request">\r\n\r\n                   <messageReceiver\r\n\r\n                            class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" \/>\r\n\r\n                   <actionMapping>urn:request<\/actionMapping>\r\n\r\n         <\/operation>\r\n\r\n<\/service><\/pre> \n 

    \u8be5Web Service\u63a5\u53d7\u4e00\u4e2aSoap\u8bf7\u6c42\uff0c\u8be5\u8bf7\u6c42\u4e3a\u5982\u4e0b\u683c\u5f0f\uff1a<\/p> \n

    <soapenv:Envelope xmlns:soapenv="http:\/\/schemas.xmlsoap.org\/soap\/envelope\/" xmlns:soap="http:\/\/soap.axis2.sky.org">\r\n\r\n   <soapenv:Header\/>\r\n\r\n   <soapenv:Body>\r\n\r\n      <soap:request>\r\n\r\n           <soap:request>?<\/soap:request>\r\n\r\n      <\/soap:request>\r\n\r\n   <\/soapenv:Body>\r\n\r\n<\/soapenv:Envelope><\/pre> \n 

    \u5176\u4e2d","orderid":"0","title":"\u901a\u5411\u67b6\u6784\u5e08\u7684\u9053\u8def\uff08\u7b2c\u5341\u4e8c\u5929\uff09\u4e4bAxis2 Web Service(\u4e09)(\u4e00)","smalltitle":"","mid":"0","fname":"JAVA","special_id":"0","bak_id":"0","info":"0","hits":"766","pages":"7","comments":"0","posttime":"2018-02-22 14:32:42","list":"1519281162","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"http:\/\/my.csdn.net\/uploads\/201207\/30\/1343630858_7175.jpg","ispic":"1","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"\u901a\u5411<\/A> \u67b6\u6784<\/A> \u5e08\u7684<\/A> \u9053\u8def<\/A> \u5341\u4e8c<\/A> Axis2<\/A> Web<\/A> Service<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"14.20.29.21","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"\u901a\u5411\u67b6\u6784\u5e08\u7684\u9053\u8def\uff08\u7b2c\u5341\u4e8c\u5929\uff09\u4e4bAxis2 Web Service(\u4e09)","lastview":"1714088581","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}