调用SOAP Service参数时,将其作为null传递

时间:2013-11-04 10:17:48

标签: c# java soap service web

我对这些网络和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);
        }
    }
}

我调试webservice和java应用程序(实际上是一个网站),当我向Web服务发出请求时,它会在Web服务的调试模式下命中断点。但是参数pMsg作为null althoguh传递我可以看到它的内容,并且在调用eclipse之前调用Web服务时它不是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服务已发布) ),我几乎不知道该怎么做。

如果有人给予意见或提供一些帮助,我们将非常感激。

1 个答案:

答案 0 :(得分:0)

  

QName中的命名空间是否需要尾部斜杠?失踪   参数可能是因为名称空间无效。

刚刚引用了评论,因此可以接受答案:)