Skip to content

gungor/spring-webclient-soap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This guide helps you run Spring WebFlux example to call SOAP services.

Run Soap Webservice

Use Java 1.8 for build and run

git clone https://github.com/spring-guides/gs-soap-service.git
cd gs-soap-service/complete
mvn clean install
java -Dserver.port=8081 -jar target/producing-web-service-0.0.1-SNAPSHOT.jar

Run WebClient example

git clone https://github.com/gungor/spring-webclient-soap.git
cd spring-webclient-soap
mvn clean install
java -jar target/spring-webclient-soap-1.0-SNAPSHOT.jar

Test

curl -X POST http://localhost:8080/countrydetails/Poland
curl -X POST http://localhost:8080/countrydetails/Spain

Test with Soap Header

curl -X POST http://localhost:8080/countrydetailsWithHeader/Poland
curl -X POST http://localhost:8080/countrydetailsWithHeader/Spain

You can track the log to see whether soap header prepared and sent correctly to WS. A request example is as below:

|00000000| 3c 53 4f 41 50 2d 45 4e 56 3a 45 6e 76 65 6c 6f |<SOAP-ENV:Envelo|
|00000010| 70 65 20 78 6d 6c 6e 73 3a 53 4f 41 50 2d 45 4e |pe xmlns:SOAP-EN|
|00000020| 56 3d 22 68 74 74 70 3a 2f 2f 73 63 68 65 6d 61 |V="http://schema|
|00000030| 73 2e 78 6d 6c 73 6f 61 70 2e 6f 72 67 2f 73 6f |s.xmlsoap.org/so|
|00000040| 61 70 2f 65 6e 76 65 6c 6f 70 65 2f 22 3e 3c 53 |ap/envelope/"><S|
|00000050| 4f 41 50 2d 45 4e 56 3a 48 65 61 64 65 72 3e 3c |OAP-ENV:Header><|
|00000060| 61 75 74 3a 75 73 65 72 6e 61 6d 65 50 61 73 73 |aut:usernamePass|
|00000070| 77 6f 72 64 20 78 6d 6c 6e 73 3a 61 75 74 3d 22 |word xmlns:aut="|
|00000080| 41 75 74 68 65 6e 74 69 63 61 74 69 6f 6e 22 20 |Authentication" |
|00000090| 61 75 74 3a 70 61 73 73 77 6f 72 64 3d 22 70 77 |aut:password="pw|
|000000a0| 22 20 61 75 74 3a 75 73 65 72 3d 22 74 65 73 74 |" aut:user="test|
|000000b0| 22 2f 3e 3c 2f 53 4f 41 50 2d 45 4e 56 3a 48 65 |"/></SOAP-ENV:He|
|000000c0| 61 64 65 72 3e 3c 53 4f 41 50 2d 45 4e 56 3a 42 |ader><SOAP-ENV:B|
|000000d0| 6f 64 79 3e 3c 6e 73 32 3a 67 65 74 43 6f 75 6e |ody><ns2:getCoun|
|000000e0| 74 72 79 52 65 71 75 65 73 74 20 78 6d 6c 6e 73 |tryRequest xmlns|
|000000f0| 3a 6e 73 32 3d 22 68 74 74 70 3a 2f 2f 73 70 72 |:ns2="http://spr|
|00000100| 69 6e 67 2e 69 6f 2f 67 75 69 64 65 73 2f 67 73 |ing.io/guides/gs|
|00000110| 2d 70 72 6f 64 75 63 69 6e 67 2d 77 65 62 2d 73 |-producing-web-s|
|00000120| 65 72 76 69 63 65 22 3e 3c 6e 73 32 3a 6e 61 6d |ervice"><ns2:nam|
|00000130| 65 3e 53 70 61 69 6e 3c 2f 6e 73 32 3a 6e 61 6d |e>Spain</ns2:nam|
|00000140| 65 3e 3c 2f 6e 73 32 3a 67 65 74 43 6f 75 6e 74 |e></ns2:getCount|
|00000150| 72 79 52 65 71 75 65 73 74 3e 3c 2f 53 4f 41 50 |ryRequest></SOAP|
|00000160| 2d 45 4e 56 3a 42 6f 64 79 3e 3c 2f 53 4f 41 50 |-ENV:Body></SOAP|
|00000170| 2d 45 4e 56 3a 45 6e 76 65 6c 6f 70 65 3e       |-ENV:Envelope>  |

Watch logs of spring-webclient-soap, it retrieves country details and logs capital. You can see how it works here: https://gungor.github.io/article/2020/08/23/soap-call-with-spring-webflux.html

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages