欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

webservice client打印报文格式

程序员文章站 2022-07-10 15:26:02
...

找到生成的客户端代码中的这个类:******SoapBindingStub

public java.lang.String custSearchById(java.lang.String data) throws java.rmi.RemoteException, cn.custcn.webservice.CustomException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[21]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("webservice.custcn.cn", "custSearchById"));

        setRequestHeaders(_call);
        setAttachments(_call);

 try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {data});
              // 打印请求和返回报文
 		System.out.println(_call.getMessageContext().getRequestMessage().getSOAPPartAsString());
 		System.out.println(_call.getMessageContext().getResponseMessage().getSOAPPartAsString());
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (java.lang.String) _resp;
            } catch (java.lang.Exception _exception) {
                return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
    if (axisFaultException.detail != null) {
        if (axisFaultException.detail instanceof java.rmi.RemoteException) {
              throw (java.rmi.RemoteException) axisFaultException.detail;
         }
        if (axisFaultException.detail instanceof cn.custcn.webservice.CustomException) {
              throw (cn.custcn.webservice.CustomException) axisFaultException.detail;
         }
   }
  throw axisFaultException;
}
    }

 

相关标签: 开发