Page 1 of 1

SOAP Envelope namespace not seen in response

Posted: Mon Aug 25, 2008 6:33 pm
by anboss
Hello

For logging requirement, i am creating a log message of type SOAP that contains request to our application and response from theapplication. These request and response messages are of type SOAP. The request and response messages are enclosed in CDATA tags.

After the required log message is created as an outcome of a transform action, i am not able to see the namespace of the "soapenv" prefix in the request message that is contained in the log message. (prob because the prefix of "Envelope" in log message and that of request is the same) how to get the namespace in the request message also?

the log request is shown below:

<soapenv:Envelope xmlns:v002="http://www.company.com/schema/app/Loggi ... Types/V001" xmlns:v1="http://www.company.com/wsdl/app/EnterpriseLogging/V1_0" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/schemas/management">
<soapenv:Header/>
<soapenv:Body>
<v002:verbosityData>
<v002:request>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<soapenv:Body>
<!-- request message body -->
</soapenv:Body>
</soapenv:Envelope>
</v002:request>
<v002:response>
<ns1:Envelope xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:osa="http://www.company.com/xmlschema/resour ... cture/v001">
<ns1:Body>
<!-- response message body -->
</ns1:Body>
</ns1:Envelope>
</v002:response>
</v002:verbosityData>
</soapenv:Body>
</soapenv:Envelope>

Re: SOAP Envelope namespace not seen in response

Posted: Tue Aug 26, 2008 6:01 pm
by sorin_ristache
Hello,
anboss wrote:After the required log message is created as an outcome of a transform action, i am not able to see the namespace of the "soapenv" prefix in the request message that is contained in the log message.
Do you mean that you generate the SOAP message with an XSLT transformation?

If yes then it seems the "soapenv" prefix is excluded from the output prefixes in your XSLT stylesheet with the attribute exclude-result-prefixes. You should check your stylesheet and allow the "soapenv" prefix to be passed to the output so that the XSLT processor inserts the declaration of this namespace prefix automatically in the output.

If no please give more details about the problem.


Regards,
Sorin

Re: SOAP Envelope namespace not seen in response

Posted: Wed Aug 27, 2008 11:16 pm
by anboss
here is my xsl. i am creating a soap message (stored in variable 'test') that contains soap messages as values for tags.

i am able to see the prefix in the output. but what happens is the name space definition for soapenv prefix.. of the soap message present in the v002:request tag is truncated and the namespace definiton is present only once at the top... in the soap message (stored in 'test') that is created.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:template match="/">
<xsl:variable name="test">
<soapenv:Envelope xmlns:dp="http://www.datapower.com/schemas/management" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v002="http://www.company.com/schema/app/Loggi ... Types/V001" xmlns:v1="http://www.company.com/wsdl/app/EnterpriseLogging/V1_0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<soapenv:Header/>
<soapenv:Body>
<v002:verbosityData>
<v002:request>
<soapenv:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body/>
</soapenv:Envelope>
</v002:request>
<v002:response>
<ns1:Envelope xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:osa="http://www.company.com/xmlschema/resour ... cture/v001">
<ns1:Body/>
</ns1:Envelope>
</v002:response>
</v002:verbosityData>
</soapenv:Body>
</soapenv:Envelope>
</xsl:variable>
<xsl:copy-of select="$test"/>
</xsl:template>
</xsl:stylesheet>

Re: SOAP Envelope namespace not seen in response

Posted: Thu Aug 28, 2008 4:59 pm
by sorin_ristache
Hello,

I think there is no problem with the SOAP message generated by the XSLT stylesheet. It is a well formed XML document in which it is enough to declare the soapenv prefix on the root element soapenv:Envelope. The prefix does not have to be declared again on the v002:request element.

The soapenv prefix must be declared on the root element because the start tag and end tag of that element use it.


Regards,
Sorin

Re: SOAP Envelope namespace not seen in response

Posted: Mon Sep 01, 2008 1:42 am
by anboss
Sorin...

is there a way to include namespace definition within each tag instead at one place?

Re: SOAP Envelope namespace not seen in response

Posted: Mon Sep 01, 2008 3:41 pm
by sorin_ristache
Hello,

You can just repeat the declaration of the prefix on every XML element of your XML document generated by the XSLT stylesheet:

Code: Select all

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
But I do not understand why you want to repeat the declaration of an XML namespace prefix for every element instead of declaring it once on the root element. The declaration of the soapenv prefix is needed on the root element anyway so repeating it in child elements is redundant.


Regards,
Sorin

Re: SOAP Envelope namespace not seen in response

Posted: Tue Sep 02, 2008 5:26 am
by anboss
the reason is we are sending the soap message containing soap messages to another web service which extracts the soap messages present inside the big one. and logs that in linux box. the remove webservice extracts the soap messages which ultimately does not contain the namespace. as a result the extracted soap message becomes invalid. we dont want the remote webservice to take the extra task of inserting appropriate namespaces.