spring-guides / gs-consuming-web-service

Consuming a SOAP web service :: Learn how to create a client that consumes a WSDL-based service
http://spring.io/guides/gs/consuming-web-service
Apache License 2.0
135 stars 166 forks source link

Web service always respond "exception" #31

Closed NicolasBriard closed 6 years ago

NicolasBriard commented 6 years ago

Hello, beginner here,

It look like the web service don't work as expected. For any request, it respond exception. Am I wrong?

Thanks.

dsyer commented 6 years ago

Hello beginner. When reporting issues, please try to think what it will be like from the other side. Does your issue have a complete description of what the problem is and how to reproduce it? If the answer is “no”, then please provide more information.

NicolasBriard commented 6 years ago

Hello, So, I follow the guide and at the end, it tell us that we can test with this command.

java -jar build/libs/gs-consuming-web-service-0.1.0.jar

The expected result is,

Requesting quote for MSFT

<StockQuotes><Stock><Symbol>MSFT</Symbol><Last>62.70</Last>...</StockQuotes>

But instead of that, I get,

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.0.RELEASE)

2018-03-20 22:53:51.745  INFO 7222 --- [           main] hello.Application                        : Starting Application v0.1.0 on nicobigarch with PID 7222 (/home/nicolas/git/gs-consuming-web-service/complete/target/gs-consuming-web-service-0.1.0.jar started by nicolas in /home/nicolas/git/gs-consuming-web-service/complete/target)
2018-03-20 22:53:51.748  INFO 7222 --- [           main] hello.Application                        : No active profile set, falling back to default profiles: default
2018-03-20 22:53:51.799  INFO 7222 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@17d99928: startup date [Tue Mar 20 22:53:51 CET 2018]; root of context hierarchy
2018-03-20 22:53:52.342  INFO 7222 --- [           main] o.s.oxm.jaxb.Jaxb2Marshaller             : Creating JAXBContext with context path [hello.wsdl]
2018-03-20 22:53:52.399  INFO 7222 --- [           main] o.s.ws.soap.saaj.SaajSoapMessageFactory  : Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
2018-03-20 22:53:52.402 DEBUG 7222 --- [           main] o.s.ws.soap.saaj.SaajSoapMessageFactory  : Using MessageFactory class [com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl]
2018-03-20 22:53:52.736  INFO 7222 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-03-20 22:53:52.752  INFO 7222 --- [           main] hello.Application                        : Started Application in 1.467 seconds (JVM running for 1.982)
2018-03-20 22:53:52.754  INFO 7222 --- [           main] hello.QuoteClient                        : Requesting quote for MSFT
2018-03-20 22:53:52.763 DEBUG 7222 --- [           main] o.s.ws.client.core.WebServiceTemplate    : Opening [org.springframework.ws.transport.http.HttpUrlConnection@77846d2c] to [http://www.webservicex.com/stockquote.asmx]
2018-03-20 22:53:52.799 DEBUG 7222 --- [           main] o.s.ws.client.MessageTracing.sent        : Sent request [SaajSoapMessage {http://www.webserviceX.NET/}GetQuote]
2018-03-20 22:53:53.534 DEBUG 7222 --- [           main] o.s.ws.client.MessageTracing.received    : Received response [SaajSoapMessage {http://www.webserviceX.NET/}GetQuoteResponse] for request [SaajSoapMessage {http://www.webserviceX.NET/}GetQuote]
exception
2018-03-20 22:53:53.543  INFO 7222 --- [       Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@17d99928: startup date [Tue Mar 20 22:53:51 CET 2018]; root of context hierarchy
2018-03-20 22:53:53.547  INFO 7222 --- [       Thread-2] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

Then, I go to http://www.webservicex.com/stockquote.asmx?op=GetQuote and test with a value (MSFT). The response is <string>exception</string>.

So, I suppose the guide is correct but the webservice doesn't respond as expected.

Thanks.

dsyer commented 6 years ago

Duplicates #27