You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Kevin Williams <ke...@dreamhousefund.com> on 2004/04/29 02:20:17 UTC
parameter null when not null issue...
Hello,
I'm hoping someone can help with this bug I'm getting. I'm connecting
to a SOAP object that was built on a Microsoft Platform. It's a
straightforward connection with one String parameter passed in. The
problem is that when I pass in the parameter, I get the following error:
'Value cannot be null. Parameter name: s'
I have no idea where that came from, and have hit a wall in my
troubleshooting attempts. Does anyone know why this might happen?
The XML I am sending is:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:AcceptXMLOrderString
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://www.portlandwinecellar.com">
<strXML xsi:type="xsd:string">hiya</strXML>
</ns1:AcceptXMLOrderString>
</soapenv:Body>
</soapenv:Envelope>
The XML it is expecting is:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AcceptXMLOrderString xmlns="http://portlandwinecellar.com/">
<strXML>string</strXML>
</AcceptXMLOrderString>
</soap:Body>
</soap:Envelope>
I don't see what the issue is here, but for some reason this is
failing! Here is my code:
String url = "http://127.0.0.1:8080"; // debugging via TCPmon
URL urlObj = new URL(url);
Vector values = new Vector();
values.add("hiya");
try {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(urlObj);
call.setOperationName(new QName("http://www.portlandwinecellar.com",
"AcceptXMLOrderString"));
call.setSOAPActionURI("http://portlandwinecellar.com/AcceptXMLOrderString");
call.setUseSOAPAction(true);
call.addParameter("strXML", org.apache.axis.Constants.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);*/
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
String ret = (String) call.invoke( values.toArray() );
System.out.println("Sent 'Hello!', got '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}
Does anyone know why this might not work? Could there be a problem with
the Service itself?
Thanks in advance!
Kevin Williams
RE: parameter null when not null issue...
Posted by Anne Thomas Manes <an...@manes.net>.
Kevin,
The message you are sending is an RPC/encoded message. The service is
expecting a document/literal message.
Key differences:
- your message is using SOAP encoding
- your message puts the <strXML> element in no namespace
- your message include xsi:type information
- the service expects the <strXML> element to be in the
http://www.portlandwinecellar namespace
- it does not expect xsi:type information
Rather than using the call interface, try using the dynamic proxy interface.
It will generate the message structure based on the WSDL description.
Anne
-----Original Message-----
From: Kevin Williams [mailto:kewilliams@dreamhousefund.com]
Sent: Wednesday, April 28, 2004 8:20 PM
To: axis-user@ws.apache.org
Subject: parameter null when not null issue...
Hello,
I'm hoping someone can help with this bug I'm getting. I'm connecting
to a SOAP object that was built on a Microsoft Platform. It's a
straightforward connection with one String parameter passed in. The
problem is that when I pass in the parameter, I get the following error:
'Value cannot be null. Parameter name: s'
I have no idea where that came from, and have hit a wall in my
troubleshooting attempts. Does anyone know why this might happen?
The XML I am sending is:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:AcceptXMLOrderString
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://www.portlandwinecellar.com">
<strXML xsi:type="xsd:string">hiya</strXML>
</ns1:AcceptXMLOrderString>
</soapenv:Body>
</soapenv:Envelope>
The XML it is expecting is:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AcceptXMLOrderString xmlns="http://portlandwinecellar.com/">
<strXML>string</strXML>
</AcceptXMLOrderString>
</soap:Body>
</soap:Envelope>
I don't see what the issue is here, but for some reason this is
failing! Here is my code:
String url = "http://127.0.0.1:8080"; // debugging via TCPmon
URL urlObj = new URL(url);
Vector values = new Vector();
values.add("hiya");
try {
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(urlObj);
call.setOperationName(new QName("http://www.portlandwinecellar.com",
"AcceptXMLOrderString"));
call.setSOAPActionURI("http://portlandwinecellar.com/AcceptXMLOrderString");
call.setUseSOAPAction(true);
call.addParameter("strXML", org.apache.axis.Constants.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);*/
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
String ret = (String) call.invoke( values.toArray() );
System.out.println("Sent 'Hello!', got '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}
Does anyone know why this might not work? Could there be a problem with
the Service itself?
Thanks in advance!
Kevin Williams