Yes. Glad I could help with this. Feel free to use and modify the code as you deem appropriate.
Ben
Yes. Glad I could help with this. Feel free to use and modify the code as you deem appropriate.
Ben
Hi Ben,
Thanks for the Jar info. That seemed to do the trick. I also perform a build/find scenario when trying to figure out jars. If anyone has a better strat I would be really interested to hear it.
Cheers,
J
Hi I've been trying to run the test client as posted above however, I get a Soap fault complaining "UndeclaredPrefix: Cannot resolve 'soapenc:string' as a QName: the prefix 'soapenc' is not declared." The code is pretty much a cut and paste from the post and deployed from the ant compiled war, so i really haven't made any changes. I've tried adding the definitions to the xsd file, but it doesn't seem to make any difference. Anyone have any ideas?
Again, still trying to get the echo service to work properly...I am relatively new to this stuff...any help would be appreciated.
Running the echo client, the SOAP request comes out to be:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<tns:echoRequest xsi:type="xsd:string"
xmlns:tns="http://www.springframework.org/spring-ws/samples/echo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
HelloBen</tns:echoRequest>
</soapenv:Body>
Yielding an error:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><s
oapenv:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring>Validation error
</faultstring><detail><spring-ws:ValidationError xmlns:spring-ws="http://springf
ramework.org/spring-ws">UndeclaredPrefix: Cannot resolve 'soapenc:string' as a Q
Name: the prefix 'soapenc' is not declared.</spring-ws:ValidationError><spring-w
s:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">Undecla
redPrefix: Cannot resolve 'soapenc:string' as a QName: the prefix 'soapenc' is n
ot declared.</spring-ws:ValidationError><spring-ws:ValidationError xmlns:spring-
ws="http://springframework.org/spring-ws">UndeclaredPrefix: Cannot resolve 'soap
enc:string' as a QName: the prefix 'soapenc' is not declared.</spring-ws:Validat
ionError><spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/
spring-ws">UndeclaredPrefix: Cannot resolve 'soapenc:string' as a QName: the pre
fix 'soapenc' is not declared.</spring-ws:ValidationError></detail></soapenv:Fau
lt></soapenv:Body>
When I run a request off the Eclipse Webservice Explorer, the request comes out to be:
<?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>
<echoString>test</echoString>
</soapenv:Body>
</soapenv:Envelope>
yielding a different error:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header />
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Validation error</faultstring>
- <detail>
<spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-elt.1: Cannot find the declaration of element 'echoString'.</spring-ws:ValidationError>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
any input would be apprecited!
You posted the body, but not the complete message, so it's kinda hard for me to figure out. It seems that somewhere, a reference to soapenc:string is made, otherwise the validator wouldn't complain about it. However, i don't see that reference.Originally Posted by sjan
You can write the entire message on a SOAPMessage object by calling writeTo(System.out), or something similar.
Thanks for the comment. That writeTo() call was really helpful. I finally figured out that the problem was a xerces mismatch between Tomcat and the compiled code.
Hi,
I am trying to run echo sample, but I get the following error message:
The prefix "echo" for element "echo:echoRequest" is not bound.; nested exception is org.xml.sax.SAXParseException: The prefix "echo" for element "echo:echoRequest" is not bound
And my soup message is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:echo="http://localhost:8080/echo">
<soapenv:Body>
<echo:echoRequest>test</echo:echoRequest>
</soapenv:Body>
</soapenv:Envelope>
And I also tried using the EchoClient on this post, and I get similar error:
The prefix "tns" for element "tns:echoRequest" is not bound.
Do you get the error on the client, or on the server side?
At any account, this seems like an XML parsing thingee. Try upgrading to the lates Xerces.
Thanks, Arjen.
I did switch to xerces-2_8_1, but I get a different error, cvc-elt.1: Cannot find the declaration of element echo:Request. I google around, they said that it's a bug in xerces, and the work around is
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
factory.setNamespaceAware(true);
But I think the code in the Spring class, and I couldn't find where I can download the spring WS source code.
Anyways, I took out the PayloadValidatingInterceptor, and it works since all the problems are related to validating xml. However, I wonder if you havn't encountered this problem, what version of xerces do you use? I tried anything lower than 2.8, it just breaks at start up. Thanks.
I do use Xerces 2.8.1, but unfortunately you need to set some JDK properties to use it. See this issue for more info.
Yes, XML parsing in Java is a pain.
Cheers,