1

我对那些网络和 SOAP 服务问题有点新手。我的问题如下: 我有一个网络服务:

[WebService(Namespace = "http://localhost:30000/QlogisticIntegration.asmx")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class QlogisticIntegration : System.Web.Services.WebService {
    [WebMethod(Description = "Qlogistik.")]
    public QlogisticResultEntity DoAccountingForProducts(QlogisticInputEntity pMsg)
    {    
    MessagingProcessor mProcessor = new MessagingProcessor();

    ResponseMessage respMsg = null;
    QlogisticResultEntity resultMessage = new QlogisticResultEntity();
    DateTime vToday = Global.GetChannel("QLOGISTIC").Today;
    Intertech.Core.Framework.Context.CurrentContext.Branch = Global.GetBranch(9019);
    Decimal exchangeRate = FxRatesQuery.GetRates(9019, "T", "D", "A",
                            pMsg.CurrencyCode,
                            vToday);

    CqlogMessage msg = new CqlogMessage();
    msg.QlogInputEntity = pMsg;

    .
    .
    .
    .
    return resultMessage;
}
}

这是我通过java调用它的方式:

public tr.com.intertech.core.QlogisticResultEntity DoAccountingForProducts(tr.com.intertech.core.QlogisticInputEntity pMsg) throws java.rmi.RemoteException {
    if (super.cachedEndpoint == null) {
        throw new org.apache.axis.NoEndPointException();
    }
    org.apache.axis.client.Call _call = createCall();        
    _call.addParameter(new javax.xml.namespace.QName("http://localhost:30000/QlogisticIntegration.asmx/", "pMsg"), new javax.xml.namespace.QName("http://localhost:30000/QlogisticIntegration.asmx/", "QlogisticInputEntity"), tr.com.intertech.core.QlogisticInputEntity.class, javax.xml.rpc.ParameterMode.IN);
    _call.setUseSOAPAction(true);
    _call.setReturnType(new javax.xml.namespace.QName("http://localhost:30000/QlogisticIntegration.asmx/", "QlogisticResultEntity"), tr.com.intertech.core.QlogisticResultEntity.class);
    _call.setSOAPActionURI("http://localhost:30000/QlogisticIntegration.asmx/DoAccountingForProducts");
    _call.setEncodingStyle(null);
    _call.setScopedProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
    _call.setScopedProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
    _call.setOperationStyle("wrapped");
    _call.setOperationName(new javax.xml.namespace.QName("http://localhost:30000/QlogisticIntegration.asmx/", "DoAccountingForProducts"));
    _call.setReturnQName(new javax.xml.namespace.QName("http://localhost:30000/QlogisticIntegration.asmx/", "DoAccountingForProductsResult"));

    java.lang.Object _resp = _call.invoke(new java.lang.Object[] {pMsg});

    if (_resp instanceof java.rmi.RemoteException) {
        throw (java.rmi.RemoteException)_resp;
    }
    else {
        try {
            return (tr.com.intertech.core.QlogisticResultEntity) _resp;
        } catch (java.lang.Exception _exception) {
            return (tr.com.intertech.core.QlogisticResultEntity) org.apache.axis.utils.JavaUtils.convert(_resp, tr.com.intertech.core.QlogisticResultEntity.class);
        }
    }
}

我调试 web 服务和 java 应用程序(实际上是一个网站),当我向 web 服务发出请求时,它在 web 服务的调试模式下命中断点。然而,参数 pMsg 被传递为 null althoguh 我可以看到它的内容,并且在调用 Web 服务之前在 Eclipse 中调试期间它不为 null。

pMsg 对象的所有属性都被初始化并给定了一个值,并且正如您所看到的参数名称和类型相同。

这是相关的wsdl:

  <?xml version="1.0" encoding="utf-8" ?> 
- <wsdl:definitions xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://localhost:30000/QlogisticIntegration.asmx" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://localhost:30000/QlogisticIntegration.asmx" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    - <wsdl:types>
        - <s:schema elementFormDefault="qualified" targetNamespace="http://localhost:30000/QlogisticIntegration.asmx">
            - <s:element name="DoAccountingForProducts">
                 - <s:complexType>
                     - <s:sequence>
                         <s:element minOccurs="0" maxOccurs="1" name="pMsg" type="tns:QlogisticInputEntity" /> 
                         </s:sequence>
                 </s:complexType>
            </s:element>
        </s:schema>
    </wsdl:types>
</wsdl:definitions>

我无法从这里到达任何地方,我使用了 fiddler,但由于我使用的是复杂的数据类型,我无法在 fiddler 上看到它,实际上我无法在端口 30000 上将 fiddler 设置为 localhost(已发布端口 Web 服务),并且我几乎不知道该怎么做。

如果有人给出意见或帮助,将不胜感激。

4

1 回答 1

0

QName 中的命名空间是否需要尾部斜杠?缺少参数可能是由于无效的命名空间。

只是引用了评论,所以它可以被接受为答案:)

于 2017-03-21T23:19:59.110 回答