You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by shale <as...@hotmail.com> on 2007/06/25 05:00:15 UTC
text/xml to application/xml trouble
I've written an axis service that a client is sending a content-type of
text/xml to with his SOAP envelope. The Axis engine is changing the
content-type to application/xml when it encounters text/xml. There are
different message Builders defined for the two content-types.
application/xml uses ApplicationXMLBuilder (by default), while text/xml uses
SOAPBuilder. SOAPBuilder seems to parse the request just fine, but
ApplicationXMLBuilder is adding an extra soapenv:Body tag which causes the
parsing process to fail. Unfortuneately, even if I change the default
builder for application/xml via th axis2.xml configuration file, the
AxisConfigutator is overriding some of the content-type to builder mappings
to specific builders (application/xml being one of them), so I'm right back
to a Builder that doesn't work.
Any suggestions?
--
View this message in context: http://www.nabble.com/text-xml-to-application-xml-trouble-tf3974013.html#a11280629
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: text/xml to application/xml trouble
Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi,
> }
> // OVERRIDE USER SPECIFED SETTINGS FOR 2 Content-types
> axisConfig.addMessageBuilder("application/xml", new
> ApplicationXMLBuilder());
>
> axisConfig.addMessageBuilder("application/x-www-form-urlencoded",
> new XFormURLEncodedBuilder());
AFAIKS this is already fixed in the trunk and will be available in the
1.3 release..
> I'm not sure I follow you comments about SOAPAction Header.
Please use a message sniffing program like tcpmon
(ws.apache.org/commons/tcpmon) to capture the messages together with
the http headers...
> Here's what a
> typical SOAP request would look like:
> <SoapEnvelope:Envelope
> xmlns:SoapEnvelope="http://schemas.xmlsoap.org/soap/envelope/">
> <SoapEnvelope:Body>
> <getCustomer>
> <cust-id>2276772</cust-id>
> </getCustomer>
> </SoapEnvelope:Body>
> </SoapEnvelope:Envelope>
By looking at the SOAP namespace you are using SOAP1.1... With SOAP1.1
you are required to have the SOAPAction http header...
If possible a quick and easy fix for this would be to use SOAP1.2...
Thanks,
Thilina
> --
> View this message in context: http://www.nabble.com/text-xml-to-application-xml-trouble-tf3974013.html#a11289868
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
--
Thilina Gunarathne - http://www.wso2.com - http://thilinag.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: text/xml to application/xml trouble
Posted by shale <as...@hotmail.com>.
Thilina Gunarathne wrote:
>
> Hi,
> Earlier Axis2 was treating messages with text/xml as the content-type
> without a SOAPAction http-header as POX messages. Reason was SOAP 1.1,
> which defines content-type of the messages as "text/xml" and it
> mandates SOAPAction header.
>
> Later with the introduction of WSDL 2.0 support (specifically the
> WSDL2 HTTPBinding support) Axis2 is using the application/xml to treat
> POX messages.. But we kept the text/xml without SOAPAction identified
> as POX mechanism for the sake of backward compatibility.
>
> Please check whether you have the SOAPAction header in your messages...
>
>> AxisConfigutator is overriding some of the content-type to builder
>> mappings
>> to specific builders (application/xml being one of them), so I'm right
>> back
>> to a Builder that doesn't work.
> It was not supposed to override the user configured builders... Are
> you using Axis2 1.2..
>
Yes I'm using Axis2 1.2. The axis2.xml settings are being overridden in the
class:
org.apache.axis2.deployment.AxisConfigBuilder.populateConfig as follows
axisConfig.addMessageBuilder("multipart/related", new
MIMEBuilder());
axisConfig.addMessageBuilder("application/soap+xml", new
SOAPBuilder());
axisConfig.addMessageBuilder("text/xml", new SOAPBuilder());
axisConfig.addMessageBuilder("application/xop+xml", new
MTOMBuilder());
// process MessageBuilders
OMElement messageBuildersElement =
config_element.getFirstChildWithName(new
QName(TAG_MESSAGE_BUILDERS));
if (messageBuildersElement != null) {
HashMap builderSelector =
processMessageBuilders(messageBuildersElement);
Iterator keys = builderSelector.keySet().iterator();
while (keys.hasNext()) {
String key = (String) keys.next();
axisConfig.addMessageBuilder(key, (Builder)
builderSelector.get(key));
}
}
// OVERRIDE USER SPECIFED SETTINGS FOR 2 Content-types
axisConfig.addMessageBuilder("application/xml", new
ApplicationXMLBuilder());
axisConfig.addMessageBuilder("application/x-www-form-urlencoded",
new XFormURLEncodedBuilder());
I'm not sure I follow you comments about SOAPAction Header. Here's what a
typical SOAP request would look like:
<SoapEnvelope:Envelope
xmlns:SoapEnvelope="http://schemas.xmlsoap.org/soap/envelope/">
<SoapEnvelope:Body>
<getCustomer>
<cust-id>2276772</cust-id>
</getCustomer>
</SoapEnvelope:Body>
</SoapEnvelope:Envelope>
--
View this message in context: http://www.nabble.com/text-xml-to-application-xml-trouble-tf3974013.html#a11289868
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: text/xml to application/xml trouble
Posted by Thilina Gunarathne <cs...@gmail.com>.
Hi,
Earlier Axis2 was treating messages with text/xml as the content-type
without a SOAPAction http-header as POX messages. Reason was SOAP 1.1,
which defines content-type of the messages as "text/xml" and it
mandates SOAPAction header.
Later with the introduction of WSDL 2.0 support (specifically the
WSDL2 HTTPBinding support) Axis2 is using the application/xml to treat
POX messages.. But we kept the text/xml without SOAPAction identified
as POX mechanism for the sake of backward compatibility.
Please check whether you have the SOAPAction header in your messages...
> AxisConfigutator is overriding some of the content-type to builder mappings
> to specific builders (application/xml being one of them), so I'm right back
> to a Builder that doesn't work.
It was not supposed to override the user configured builders... Are
you using Axis2 1.2..
Thanks,
Thilina
>
> Any suggestions?
> --
> View this message in context: http://www.nabble.com/text-xml-to-application-xml-trouble-tf3974013.html#a11280629
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
--
Thilina Gunarathne - http://www.wso2.com - http://thilinag.blogspot.com
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org