Averroes
Averroes

Reputation: 4228

SOAP MalformedURIException with character ^

I have to call a webservice with SOAP that happens to have a ^ in the URL. The URL has this structure

String url = "http://sampleurl.com?type=entry&version=1.0&Sender.Service=SenderService&Interface=sampleurl/ABC^ServiceRequest";

This gives me the following exception:

com.sun.xml.messaging.saaj.util.JaxmURI$MalformedURIException: Query string contains invalid character:^
11:47:10,670 ERROR [STDERR]     at com.sun.xml.messaging.saaj.util.JaxmURI.initializePath(JaxmURI.java:690)
11:47:10,670 ERROR [STDERR]     at com.sun.xml.messaging.saaj.util.JaxmURI.initialize(JaxmURI.java:407)
11:47:10,670 ERROR [STDERR]     at com.sun.xml.messaging.saaj.util.JaxmURI.<init>(JaxmURI.java:194)
11:47:10,670 ERROR [STDERR]     at com.sun.xml.messaging.saaj.util.JaxmURI.<init>(JaxmURI.java:178)
11:47:10,670 ERROR [STDERR]     at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:254)

The thing that puzzle me out is that calling the webservice with SOAP UI gives me a correct answer even if I put the ^ in the URL.

If I scape the caret character to %5e in my application or in SOAP UI the webservice responds "Message is incomplete. No Sender found" so it seems that the ^ must be present.

Any idea of how to put ^ in the URL without giving an exception?

Upvotes: 0

Views: 514

Answers (1)

albciff
albciff

Reputation: 18507

The ^ character is not allowed in URL, probably SOAPUI is encoding the URL for you. I think the case representation is importat for URL escape characters try with uppercase %5E instead of lowercase %5e.

EDIT:

I just make a try configuring a TCP monitor on my localhost and making a SOAP request from SOAPUI to http://localhost:8091?type=entry&version=1.0&Sender.Service=SenderService&Interface=sampleurl/ABC^ServiceRequest. In the TCP monitor I see %5E instead of ^ so it seems that SOAPUI is encoding the URL properly, you can see this in the image below:

enter image description here

Hope this helps,

Upvotes: 1

Related Questions