SOAPExtension to strip shiteSpaces (Invoking WCF webservice)

Hi Guys,

I am trying to consume on WCF webservice in webMethods 7.1.2 environment and the invokes are failing with the error SOAP message is invalid.

I dig into the issue and found out that if i set the “Strip Whitespaces” to true in SOAP - UI client the invoke works fine, searched web and can see lot of people has faced the similar issue? IS anybody solved this in webMethods or have to write the custom java code to strip whitespaces?

[URL]http://www.hanselman.com/blog/ASMXSoapExtensionToStripOutWhitespaceAndNewLines.aspx[/URL]

Hmm. The article link doesn’t indicate an error occurred, just that the person wanted to retain the original formatting. Whitespace between elements is not significant for XML parsing. E.g. the following XML snippets are equivalent:

<a><b></b></a>

<a>
  <b>
  </b>
</a>

Thus if a web service call is failing simply because there is whitespace then that web service is not behaving correctly.

Additionally, whitespace within a tag is significant and must be preserved by a parser.

Thanks for responding to this post!

I agree to the fact the blank spaces within the spaces are relevent to data, but i double checked there is no blank spaces in request data but there are some whitespaces between the tags of SOAP data … like below and somehow its causing the issue.

[547]</SOAP-ENV:Envelope>
[546]</SOAP-ENV:Body>
[545]</tns:Read>[0LF]
[544] [0LF]tns:No10000</tns:No>
[543][0LF] tns:Read
[542]SOAP-ENV:Body
[541] SOAP-ENV:Header</SOAP-ENV:Header> [0LF]
[540]SOAP-ENV:Envelope

When i invoke the same service with SOAP-UI by setting strip whitespace setting. it works fine … any 'suggestions of this front.

thnx

Just to add… if i m not stripping the whitespaces… i am getting the below soap fault…

<s:Envelope xmlns:s=“http://schemas.xmlsoap.org/soap/envelope/[/URL]”>
<s:Body>
<s:Fault>
a:System.Net.WebException
Soap message is invalid!

Soap message is invalid!

</s:Fault>
</s:Body>
</s:Envelope>

The whitespace between tags is not significant. Any parser that it failing because of such space is incorrect. Whomever is hosting the web service you’re calling needs to open a ticket with MS because it is not behaving as it should.

thanks Rob!
I am in a kind of situation here, system which is hosting the webservice can’t fix the issue beacuse of unavoidable situations… (though there is a service pack from MS for this problem) … i was wondering if any idea comes to your mind for a workable soultion in webMethods … FYI, i created a soap handler service to strip the whitespaces from the soap data but it does not seems to be working…
WOuld be great if you can give me some pointers…

thnx!
naren

What I would do is add this issue to the partner’s list of “situations.” :slight_smile: The question is one of how much pain do you want to endure for someone else’s problem?

One approach would be to handle the call completely with your own code (no WSD/connector). Build the XML directly and do the HTTP post yourself.

I liked that line for “situations” :smiley:

Yep - i have already took the approach of Soap over http and seems working for me…

thanks anyways for your inputs!