PDA

View Full Version : How to test the Echo sample?



benethridge
Jun 21st, 2006, 04:36 PM
This is probably going to be silly, but how do you run the Echo sample app?

I have it cleanly war'd and deployed to tomcat, i.e. I see the:

Spring-WS Echo
If you see this page, the WAR deployment was successful.

...but I don't see a main method (in, say, EchoEndpointTest.java) or a jsp with which to kick off a test.

Ben

res1st
Jun 22nd, 2006, 01:15 AM
Hi Ben,

there isn't any client.
You can use the "Web Service Explorer" from Eclipse (WTP) to test it.
Or you create your own client from the wsdl (JWSDP,Axis,XFire,...).

Cheers,

Ingo

benethridge
Jun 22nd, 2006, 10:43 AM
Thanks.

If I fire up the Web Services Explorer in Eclipse, it wants to know about the uddi registry. (I've never used that one before, but am prett familiar with most of Eclipse.) I don't quite see how to test Echo there yet. Can you show me the way?

I'm used to "injecting" Axis into my deployed app in Tomcat, such that I can then see the WSDL, if I go to the url, say:

http://localhost:8080/myApp/services/mySOAPBindingPort?wsdl

...but when I do that with the echo app:

http://localhost:8080/echo/services

...which is from your wsdl here:

<wsdl:service name="TestService">
<wsdl:port binding="tns:TestServiceHttpBinding" name="TestServiceHttpPort">
<wsdlsoap:address location="http://localhost:8080/echo/services"/>
</wsdl:port>
</wsdl:service>

....I get a blank screen. Same blank screen if I try:

http://localhost:8080/echo/services?wsdl

The tomcat startup looks clean, and when I do the above, just shows:

2006-06-22 11:38:31,401 INFO [org.springframework.ws.transport.http.MessageHandl
erAdapter] - Using message context factory org.springframework.ws.soap.saaj.Saaj
SoapMessageContextFactory@1e6f0ef


...which looks reasonable.

I've read through the spring-ws-core-reference.pdf, but I don't yet see how to fully deploy and test a simple Spring Web Service.

Am I missing something in the documentation? or ?

Ben

Arjen Poutsma
Jun 22nd, 2006, 04:28 PM
I'm used to "injecting" Axis into my deployed app in Tomcat, such that I can then see the WSDL, if I go to the url, say:

http://localhost:8080/myApp/services/mySOAPBindingPort?wsdl

...but when I do that with the echo app:

http://localhost:8080/echo/services

...which is from your wsdl here:

<wsdl:service name="TestService">
<wsdl:port binding="tns:TestServiceHttpBinding" name="TestServiceHttpPort">
<wsdlsoap:address location="http://localhost:8080/echo/services"/>
</wsdl:port>
</wsdl:service>

....I get a blank screen. Same blank screen if I try:

http://localhost:8080/echo/services?wsdl

The tomcat startup looks clean, and when I do the above, just shows:

2006-06-22 11:38:31,401 INFO [org.springframework.ws.transport.http.MessageHandl
erAdapter] - Using message context factory org.springframework.ws.soap.saaj.Saaj
SoapMessageContextFactory@1e6f0ef


...which looks reasonable.


Spring-WS doesn not automatically generate or publish the WSDL document under services/something?wsdl, because it is based on contract-first development: you write the WSDL yourself. Therefore, the WSDL is just a plain file in the war. If you look in the war, you will find an echo.wsdl, which you can point your client at using http://localhost:8080/echo/echo.wsdl. It's just a file, after all :-).



I've read through the spring-ws-core-reference.pdf, but I don't yet see how to fully deploy and test a simple Spring Web Service.

Am I missing something in the documentation? or ?


It could be you are missing information in the documentation, because the documentation is still in progress. I'm mostly focussing on the WS-security chapter now, because that is what people have the most questions about, but I hope to finish the other chapter (about the core WS functionality) soon.

Cheers,

res1st
Jun 23rd, 2006, 01:03 AM
If I fire up the Web Services Explorer in Eclipse, it wants to know about the uddi registry. (I've never used that one before, but am prett familiar with most of Eclipse.) I don't quite see how to test Echo there yet. Can you show me the way?
On the top right bar are six buttons. Click on "wsdl page" and choose the one from the project. Now you can test the web servicee.

The Web Service Explorer has a (already reported) bug. In my case, i have to deactivate the internet/proxy settings.

Cheers,

Ingo

benethridge
Jun 23rd, 2006, 09:33 AM
Thanks, Ingo (and you too, Argen).

I see that now. I think the missing piece is that I deployed the Echo "project" straight from java, with your build.xml, which made a war that I deployed straight into tomcat, i.e. I bypassed Eclipse coz I couldn't figure out how to import it into Eclipse

Can you tell me the best way to import it into Eclipse? I've tried a couple of ways (including attempting to import the generated echo.war), but nothing has lined up cleanly yet. (I have Eclipse 3.1.x)

Ben

benethridge
Jun 30th, 2006, 03:32 PM
FWIW: Here is a simple test client I wrote for the Echo project. I just cloned/morphed the client from the Airline project:



/*
* Copyright (c) 2006, Your Corporation. All Rights Reserved.
* Copyright 2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.ws.samples.echo.client.saaj;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.soap.MessageFactory;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFault;
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;

public class EchoClient {

public static final String NAMESPACE_URI = "http://www.springframework.org/spring-ws/samples/echo";

public static final String PREFIX = "tns";

private SOAPConnectionFactory connectionFactory;

private MessageFactory messageFactory;

private URL url;

private TransformerFactory transfomerFactory;

public EchoClient(String url) throws SOAPException,
MalformedURLException {
connectionFactory = SOAPConnectionFactory.newInstance();
messageFactory = MessageFactory.newInstance();
transfomerFactory = TransformerFactory.newInstance();
this.url = new URL(url);
}

private SOAPMessage createEchoRequest() throws SOAPException {
SOAPMessage message = messageFactory.createMessage();
SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
Name echoRequestName = envelope.createName("echoRequest", PREFIX,
NAMESPACE_URI);
SOAPBodyElement echoRequestElement = message.getSOAPBody()
.addBodyElement(echoRequestName);
echoRequestElement.setValue("HelloBen");
return message;
}

public void callWebService() throws SOAPException, IOException,
TransformerException {
SOAPMessage request = createEchoRequest();
SOAPConnection connection = connectionFactory.createConnection();
SOAPMessage response = connection.call(request, url);
if (!response.getSOAPBody().hasFault()) {
writeEchoResponse(response);
} else {
SOAPFault fault = response.getSOAPBody().getFault();
System.err.println("Received SOAP Fault");
System.err.println("SOAP Fault Code :" + fault.getFaultCode());
System.err.println("SOAP Fault String :" + fault.getFaultString());
}
}

private void writeEchoResponse(SOAPMessage message) throws SOAPException,
TransformerException {
SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
Name echoResponseName = envelope.createName("echoResponse", PREFIX,
NAMESPACE_URI);
SOAPBodyElement echoResponseElement = (SOAPBodyElement) message
.getSOAPBody().getChildElements(echoResponseName). next();
String echoValue = echoResponseElement.getTextContent();
System.out.println("Echo Value: " + echoValue);
}

public static void main(String[] args) throws Exception {
String url = "http://localhost:8080/echo/services";
if (args.length > 0) {
url = args[0];
}
EchoClient echoClient = new EchoClient(url);
echoClient.callWebService();
}
}

Jonathan Maguire
Jul 4th, 2006, 04:19 AM
Hi,

Probs a silly question but what Jar files are required in order to get the above SOAP Client to work. Do I require Axis jars or another implementation of saaj?

Thanks,

J

benethridge
Jul 5th, 2006, 11:23 AM
They would be the following:

saaj-api.jar
saaj-impl.jar
mail.jar
activation.jar
xercesImpl.jar

You can get them from the echo project or the airline project.

I discovered which ones were needed, by creating a simple Java "echoclient" project, and then (as usual in java) building it, and seeing what it was missing, and then running it, and seeing which classes were not found.

I wish there were a better way to do this in java, as I've never enjoyed this part of the process, and it seems so unreliable coz you have to discover them at run-time instead of compile-time. Is there a better way?

Ben

Arjen Poutsma
Jul 6th, 2006, 07:53 AM
I've created a JIRA issue for the Echo client http://opensource.atlassian.com/projects/spring/browse/SWS-41. I will add it soon, if you (Ben), allow me to include your code to the SWS codebase. You already "released" it under the Apache license, so I don't think this will be a problem, but I'm asking just to be sure.

Thanks,

benethridge
Jul 6th, 2006, 09:15 AM
Yes. Glad I could help with this. Feel free to use and modify the code as you deem appropriate.

Ben

Jonathan Maguire
Jul 8th, 2006, 10:24 AM
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

sjan
Jul 14th, 2006, 09:54 AM
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?

sjan
Jul 14th, 2006, 12:28 PM
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!

Arjen Poutsma
Jul 16th, 2006, 06:15 PM
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>


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.

You can write the entire message on a SOAPMessage object by calling writeTo(System.out), or something similar.

sjan
Jul 16th, 2006, 08:39 PM
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.

xmichelle
Nov 2nd, 2006, 07:32 PM
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.

Arjen Poutsma
Nov 3rd, 2006, 03:22 AM
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.

xmichelle
Nov 3rd, 2006, 01:33 PM
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.

Arjen Poutsma
Nov 3rd, 2006, 05:25 PM
I do use Xerces 2.8.1, but unfortunately you need to set some JDK properties to use it. See this issue (http://opensource.atlassian.com/projects/spring/browse/SWS-35) for more info.

Yes, XML parsing in Java is a pain ;).

Cheers,

cpires
Mar 22nd, 2007, 05:56 AM
I have some problems with the echo sample. 1st http://localhost:8080/echo/EchoService?wsdl and http://localhost:8080/echo/services throws this exception:


javax.servlet.ServletException: Request method 'GET' not supported
org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceiverHandlerAdapter.java:64)
org.springframework.ws.transport.http.MessageDispa tcherServlet.doService(MessageDispatcherServlet.ja va:125)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:396)
org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:350)
javax.servlet.http.HttpServlet.service(HttpServlet .java:689)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

But http://localhost:8080/echo/echo.wsdl is ok.

When I try the client I have this error:

SEVERE: SAAJ0511: Unable to create envelope from given source
Exception in thread "main" org.springframework.ws.soap.saaj.SaajSoapEnvelopeE xception: Could not access envelope: Unable to create envelope from given source: ; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Unable to create envelope from given source:
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Unable to create envelope from given source:
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeF actory.createEnvelope(EnvelopeFactory.java:114)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SO APPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1 Impl.java:71)
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartI mpl.getEnvelope(SOAPPartImpl.java:125)
at org.springframework.ws.soap.saaj.Saaj13Implementat ion.getEnvelope(Saaj13Implementation.java:145)
at org.springframework.ws.soap.saaj.SaajSoapMessage.g etEnvelope(SaajSoapMessage.java:84)
at org.springframework.ws.soap.AbstractSoapMessage.ge tSoapBody(AbstractSoapMessage.java:35)
at org.springframework.ws.soap.AbstractSoapMessage.ha sFault(AbstractSoapMessage.java:63)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:200)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:173)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:151)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:145)
at org.springframework.ws.samples.echo.client.sws.Ech oClient.echo(EchoClient.java:40)
at org.springframework.ws.samples.echo.client.sws.Ech oClient.main(EchoClient.java:48)
Caused by: javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The element type "HR" must be terminated by the matching end-tag "</HR>".
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:501)
at com.sun.xml.internal.messaging.saaj.util.transform .EfficientStreamingTransformer.transform(Efficient StreamingTransformer.java:390)
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeF actory.createEnvelope(EnvelopeFactory.java:102)
... 12 more
Caused by: org.xml.sax.SAXParseException: The element type "HR" must be terminated by the matching end-tag "</HR>".
at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(AbstractSAXParser.java:1231)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserI mpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterI mpl.java:333)
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:484)
... 14 more

CAUSE:

javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The element type "HR" must be terminated by the matching end-tag "</HR>".
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:501)
at com.sun.xml.internal.messaging.saaj.util.transform .EfficientStreamingTransformer.transform(Efficient StreamingTransformer.java:390)
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeF actory.createEnvelope(EnvelopeFactory.java:102)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SO APPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1 Impl.java:71)
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartI mpl.getEnvelope(SOAPPartImpl.java:125)
at org.springframework.ws.soap.saaj.Saaj13Implementat ion.getEnvelope(Saaj13Implementation.java:145)
at org.springframework.ws.soap.saaj.SaajSoapMessage.g etEnvelope(SaajSoapMessage.java:84)
at org.springframework.ws.soap.AbstractSoapMessage.ge tSoapBody(AbstractSoapMessage.java:35)
at org.springframework.ws.soap.AbstractSoapMessage.ha sFault(AbstractSoapMessage.java:63)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:200)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:173)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:151)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:145)
at org.springframework.ws.samples.echo.client.sws.Ech oClient.echo(EchoClient.java:40)
at org.springframework.ws.samples.echo.client.sws.Ech oClient.main(EchoClient.java:48)
Caused by: org.xml.sax.SAXParseException: The element type "HR" must be terminated by the matching end-tag "</HR>".
at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(AbstractSAXParser.java:1231)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserI mpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterI mpl.java:333)
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:484)
... 14 more
---------
org.xml.sax.SAXParseException: The element type "HR" must be terminated by the matching end-tag "</HR>".
at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(AbstractSAXParser.java:1231)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserI mpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterI mpl.java:333)
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:484)
at com.sun.xml.internal.messaging.saaj.util.transform .EfficientStreamingTransformer.transform(Efficient StreamingTransformer.java:390)
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeF actory.createEnvelope(EnvelopeFactory.java:102)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SO APPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1 Impl.java:71)
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartI mpl.getEnvelope(SOAPPartImpl.java:125)
at org.springframework.ws.soap.saaj.Saaj13Implementat ion.getEnvelope(Saaj13Implementation.java:145)
at org.springframework.ws.soap.saaj.SaajSoapMessage.g etEnvelope(SaajSoapMessage.java:84)
at org.springframework.ws.soap.AbstractSoapMessage.ge tSoapBody(AbstractSoapMessage.java:35)
at org.springframework.ws.soap.AbstractSoapMessage.ha sFault(AbstractSoapMessage.java:63)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:200)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:173)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:151)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:145)
at org.springframework.ws.samples.echo.client.sws.Ech oClient.echo(EchoClient.java:40)
at org.springframework.ws.samples.echo.client.sws.Ech oClient.main(EchoClient.java:48)

Any idea of what I can do to solve these problems?

Arjen Poutsma
Mar 22nd, 2007, 06:12 AM
The first exception is actually expected behavior, because SOAP only supports POSTs, and every URL that is not 'echo.wsdl' will result in a soap call.

The second exception seems to be related to the fact that the service is not returning a SOAP envelope, but HTML instead. You can use soapUI http://www.soapui.org to figure out what the server is returning. Just give it the WSDL url (http://localhost:8080/echo/echo.wsdl) and it's ready to go.

cpires
Mar 22nd, 2007, 06:21 AM
Why is this happening with the sample? The sample is supposed to run with no problems...

cpires
Mar 22nd, 2007, 06:26 AM
The first exception is actually expected behavior, because SOAP only supports POSTs, and every URL that is not 'echo.wsdl' will result in a soap call.

The second exception seems to be related to the fact that the service is not returning a SOAP envelope, but HTML instead. You can use soapUI http://www.soapui.org to figure out what the server is returning. Just give it the WSDL url (http://localhost:8080/echo/echo.wsdl) and it's ready to go.

what I'm supposed to do after the bold part? (sorry for the noob question)
My objective is to run the echo client sample, so after using soapUI what I have to do?

Arjen Poutsma
Mar 22nd, 2007, 06:32 AM
soapUI is a tool which allows you to see the request and response. The idea is that you give it a WSDL, and it will create default requests for you. You can then execute these requests (in the left-hand pane), and you will see the responses (in the right-side pane).

Like I said before, it seems that your server gives back an (HTML) error stack trace, but the SAAJ client cannot handle that, so it gives back an exception. soapUI is basically a different client, which allows you to see what the response is. It's a good tool to test web services as well.

cpires
Mar 22nd, 2007, 06:38 AM
I'm using tomcat as server and even after using soapUI, I don't know what to do

cpires
Mar 22nd, 2007, 10:46 AM
As when I try http://localhost:8080/echo/services I get

javax.servlet.ServletException: Request method 'GET' not supported
org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceiverHandlerAdapter.java:64)
org.springframework.ws.transport.http.MessageDispa tcherServlet.doService(MessageDispatcherServlet.ja va:125)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:396)
org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:350)
javax.servlet.http.HttpServlet.service(HttpServlet .java:689)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)

what should I do to run the client of the echo sample?

I'm asking that because the applicationContext.xml of the client points to this url...

<bean id="urlMessageSender" class="org.springframework.ws.transport.http.HttpUrlConne ctionMessageSender">
<property name="url" value="http://localhost:8080/echo/services"/>
</bean>

<bean id="commonsMessageSender" class="org.springframework.ws.transport.http.CommonsHttpM essageSender">
<property name="url" value="http://localhost:8080/echo/services"/>
</bean>

About the soapUI, it tells me that at line 32 </body> doesn't close tag <HR>. What this is supposed to mean?

Arjen Poutsma
Mar 23rd, 2007, 03:57 AM
The response pane in soapUI (i.e. the right-hand pane) should show the response that the server gives you. In your case, this response consists of HTML (<HR> tags are HTML, not SOAP), so that typically means that you have an exception stack trace as well.

What does the right-hand pane show? What is in your tomcat logs?

cpires
Mar 23rd, 2007, 05:52 AM
The right pane show me what is in the soapUI_answer.txt. In my tomcat logs I found this:

StandardWrapperValve[spring-ws]: Servlet.service() for servlet spring-ws threw exception
java.lang.NoSuchMethodError: javax.xml.transform.dom.DOMResult.getNextSibling() Lorg/w3c/dom/Node;
at org.apache.xalan.transformer.TransformerIdentityIm pl.createResultContentHandler(TransformerIdentityI mpl.java:199)
at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:329)
at com.sun.xml.internal.messaging.saaj.util.transform .EfficientStreamingTransformer.transform(Efficient StreamingTransformer.java:390)
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeF actory.createEnvelope(EnvelopeFactory.java:102)
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SO APPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1 Impl.java:71)
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartI mpl.getEnvelope(SOAPPartImpl.java:122)
at org.springframework.ws.soap.saaj.Saaj13Implementat ion.getEnvelope(Saaj13Implementation.java:145)
at org.springframework.ws.soap.saaj.SaajSoapMessage.g etEnvelope(SaajSoapMessage.java:84)
at org.springframework.ws.soap.AbstractSoapMessage.ge tSoapBody(AbstractSoapMessage.java:35)
at org.springframework.ws.soap.AbstractSoapMessage.ge tPayloadSource(AbstractSoapMessage.java:49)
at org.springframework.ws.server.endpoint.mapping.Pay loadRootQNameEndpointMapping.getMessagePayloadElem ent(PayloadRootQNameEndpointMapping.java:63)
at org.springframework.ws.server.endpoint.mapping.Pay loadRootQNameEndpointMapping.resolveQName(PayloadR ootQNameEndpointMapping.java:56)
at org.springframework.ws.server.endpoint.mapping.Abs tractQNameEndpointMapping.getLookupKeyForMessage(A bstractQNameEndpointMapping.java:32)
at org.springframework.ws.server.endpoint.mapping.Abs tractMapBasedEndpointMapping.getEndpointInternal(A bstractMapBasedEndpointMapping.java:107)
at org.springframework.ws.server.endpoint.mapping.Abs tractEndpointMapping.getEndpoint(AbstractEndpointM apping.java:86)
at org.springframework.ws.server.MessageDispatcher.ge tEndpoint(MessageDispatcher.java:232)
at org.springframework.ws.server.MessageDispatcher.di spatch(MessageDispatcher.java:185)
at org.springframework.ws.server.MessageDispatcher.re ceive(MessageDispatcher.java:166)
at org.springframework.ws.transport.support.WebServic eMessageReceiverObjectSupport.handle(WebServiceMes sageReceiverObjectSupport.java:78)
at org.springframework.ws.transport.http.WebServiceMe ssageReceiverHandlerAdapter.handle(WebServiceMessa geReceiverHandlerAdapter.java:60)
at org.springframework.ws.transport.http.MessageDispa tcherServlet.doService(MessageDispatcherServlet.ja va:125)
at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:396)
at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:360)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:619)

cpires
Mar 23rd, 2007, 10:40 AM
Well, I decided to use XFire and now I can run the echo example and the client with no problem. I have another problem, this time with XFire. When my web services uses data of type hashtable I always have a similar problem of what was hapenning with spring-ws echo example.

SoapUI:
<html><head><title>Apache Tomcat/5.0.28 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.servlet.ServletException: Error occured during request processing: null
org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:757)
org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:658)
org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:392)
org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:357)
javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
</pre></p><p><b>root cause</b> <pre>java.lang.StackOverflowError
com.ctc.wstx.sr.BasicStreamReader.getAttributeValu e(BasicStreamReader.java:643)
org.codehaus.xfire.util.stax.DepthXMLStreamReader. getAttributeValue(DepthXMLStreamReader.java:75)
org.codehaus.xfire.util.stax.DepthXMLStreamReader. getAttributeValue(DepthXMLStreamReader.java:75)
org.codehaus.xfire.aegis.stax.ElementReader.getAtt ributeReader(ElementReader.java:256)
org.codehaus.xfire.aegis.type.basic.ObjectType.rea dObject(ObjectType.java:133)

.... (a lot of repetitions of the same)....
org.codehaus.xfire.aegis.type.basic.ObjectType.rea dObject(ObjectType.java:133)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.0.28</h3></body></html>

and </body> does not close tag <HR>

Tomcat logs:

2007-03-23 15:42:58,428 ERROR [org.springframework.web.servlet.DispatcherServlet] - Could not complete request
javax.servlet.ServletException: Error occured during request processing: null
at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:757)
at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:658)
at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:392)
at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:357)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:619)


I don't know why this happen. Should I open a new thread?

If you want my code I can put it here

cpires
Mar 23rd, 2007, 11:21 AM
Problem solved, that was nothing related to XFire, just a little mistake. tks all.