From ed5768da1363742eee34c6c71db010099da6fad8 Mon Sep 17 00:00:00 2001 From: ludc <pUXmgxCf6A> Date: 星期三, 17 五月 2023 21:55:07 +0800 Subject: [PATCH] 以及发布webservice接口功能搭建,将通通用接口移植过来 --- Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/webservice/WsClientUtil.java | 61 ++++++++++++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/webservice/WsClientUtil.java b/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/webservice/WsClientUtil.java index e69de29..19965ff 100644 --- a/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/webservice/WsClientUtil.java +++ b/Source/UBCS/ubcs-service/ubcs-webservice/src/main/java/com/vci/ubcs/webservice/WsClientUtil.java @@ -0,0 +1,61 @@ +/* +package com.vci.ubcs.webservice; + +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axiom.om.OMNamespace; +import org.apache.axiom.soap.SOAP11Constants; +import org.apache.axis2.Constants; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; +import org.apache.commons.lang3.StringUtils; + +public class WsClientUtil { + + */ +/** + * axis2璋冪敤瀹㈡埛绔� + * + * @param url 璇锋眰鏈嶅姟鍦板潃 + * @param nameSpace 鍛藉悕绌洪棿 + * @param soapAction soapAction + * @param method 鏂规硶鍚� + * @param paramName 鍙傛暟鍚嶇О + * @param sendData 璇锋眰鎶ユ枃 + * @param timeOutInMilliSeconds 瓒呮椂鏃堕棿 + * @return String 绫诲瀷鐨勫搷搴旀姤鏂� + *//* + + public static String sendMsg(String url, String nameSpace,String soapAction, String method, String paramName, String sendData, long timeOutInMilliSeconds) throws Exception { + ServiceClient serviceClient = new ServiceClient(); + Options option = new Options(); + option.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI); + option.setTransportInProtocol(Constants.TRANSPORT_HTTP); + + // 鍊间负targetNamespace+methodName + if(StringUtils.isEmpty(soapAction)){ + soapAction = nameSpace+method; + } + option.setAction(soapAction); + + EndpointReference epfs = new EndpointReference(url); + option.setTo(epfs); + serviceClient.setOptions(option); + + OMFactory fac = OMAbstractFactory.getOMFactory(); + OMNamespace namespaceOM = fac.createOMNamespace(nameSpace, ""); + OMElement element = fac.createOMElement(method, namespaceOM); + OMElement theCityCode = fac.createOMElement(paramName, namespaceOM); + theCityCode.setText(sendData); + element.addChild(theCityCode); + + + OMElement resultOM = serviceClient.sendReceive(element); + + String result = resultOM.getFirstElement().getText(); + return result; + } +} +*/ -- Gitblit v1.9.3