开发者

Parameters not passed to .net webservice

I'm having a problem in passing my parameters to a .Net webservice. I'm using axis and java as a client. when I run my java client and debug my webservice at the same time I am able to invoke the webservice but when I check the parameters passed to the .net webservice the value is nothing. what should I do?

Here is my code:

try {
    String endpoint = "http://localhost/Test/Service.asmx?WSDL";
    Service  xxx = new Service();
    Call call = (Call) (xxx.createCall());

    sAcctNo = "test";

    call.setTargetEndpointAddress( new java.net.URL(sEndPoint) );
    call.setProperty(javax.xml.rpc.Call.SOAPACTION_USE_PROPERTY,new Boolean(true));
    call.setProperty(javax.xml.rpc.Call.SOAPACTION_URI_PROPERTY,"http://tempuri.org/GetName");
    call.setOperationName(new QName("GetName"));

    call.setProperty(javax.xml.rpc.Call.OPERATION_STYLE_PROPERTY,"document");

    call.addParameter( new QName("http://tempuri.org","str"),XMLType开发者_开发问答.XSD_STRING,ParameterMode.IN);
    call.setReturnType(XMLType.XSD_STRING);

    call.setEncodingStyle(null);

    ret = (String) call.invoke( new Object[]{ sAcctNo  } );
    out.println("You passed : '" + ret + "'");

} catch (Exception e) {
    System.err.println(e.toString());
}


I think it might be a namespace issue with the operation name.

Try replacing:

call.setOperationName(new QName("GetName"));

with

call.setOperationName(new QName("http://tempuri.org", "GetName"));

Namespace is the first parameter of QName constructor. It might help to debug the SOAP message from a working .NET client and compare to the generated Java client message.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜