[ 
https://issues.apache.org/jira/browse/AXIS2-4184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658327#action_12658327
 ] 

Andreas Veithen commented on AXIS2-4184:
----------------------------------------

I think that the key to understand this issue is in the first three lines of 
the logs. What happens here is that Axis2 silently switches the content type 
from text/xml to application/xml. The code that is responsible for this is can 
be found in HTTPTransportUtils#initializeMessageContext and 
TransportUtils#createDocumentElement. The content type is switched to 
application/xml if all of the following conditions are met:

1) The (original) content type is text/xml.
2) There is no SOAP action.
3) REST is enabled.

In this case Axis2 thinks that the request is a REST style request, not SOAP 
1.1. It then parses the message as plain XML and the 
SOAPMessageBodyBasedDispatcher will see SOAP-ENV:Envelope as the root element. 
There are two possible workarounds in your case: switch to SOAP 1.2 (which uses 
application/soap+xml instead of text/xml) or disable REST.

Further analysis and possible improvements to Axis2:

The problem comes from the fact that the text/xml content type is ambiguous: it 
is used both for SOAP 1.1 messages and for REST style service invocations. The 
current way to handle this situation has two flaws:

* Axis2 tries to distinguish between SOAP and REST using hardcoded logic hidden 
in TransportUtils#createDocumentElement, which is not the right place for this.
* The issue described here shows that there are cases where it is not possible 
to distinguish between SOAP 1.1 and REST by inspecting only the transport 
headers.

My proposal to improve this would be to:

* Remove the hardcoded logic from TransportUtils#createDocumentElement, i.e. 
simply delegate the processing of the message to the message builder registered 
for text/xml.
* Instead of using SOAPBuilder to handle text/xml, create a new builder 
specifically for this content type. This new message builder would then 
distinguish between SOAP and plain XML by inspecting the message, i.e. by 
checking whether the message has a SOAP envelope or not (see WSCOMMONS-421 for 
a necessary change in Axiom to support this). Only afterwards it would inspect 
the headers (presence of a SOAP action) and the configuration (REST enabled or 
not) to check if the type of message is acceptable.

This would improve Axis2's design because all the logic is where it should be, 
namely in the message builder, and would also allow Axis2 to cope with 
situations as described here where the ambiguity between SOAP and REST can't be 
resolved easily.

> SOAP Message Body Based dispatcher does not work without SOAPAction
> -------------------------------------------------------------------
>
>                 Key: AXIS2-4184
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4184
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.4.1
>         Environment: AXIS2 1.4.1 with Websphere 5.1
>            Reporter: Sach
>
> I am havign an issue with dispatching to the write operation with the 
> following error:
>   org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation 
> not found is         
> http://fir.abc.net:9087/docaccess/services/SearchElectronicDocumentService 
> and the WSA Action = null
> SOAP envelope:
> <SOAP-ENV:Envelope 
> xmlns:ser="http://abc.com/schemas/custom/documentaccess/pct/SearchElectronicDocument_V1";
>  
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xmlns:wsec="http://abc.com/wsecurity-sec-1.0.xsd"; 
> xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"; >
> <SOAP-ENV:Body>
> <searchElectronicDocument 
> xmlns="http://abc.com/schemas/custom/documentaccess/pct/SearchElectronicDocument_V1";>
> <searchCondition>
> <propertyInfo>
> <kind>AGENT_NUMBER</kind>
> <theValue>222</theValue></propertyInfo></searchCondition>
> <searchFields>
> <kind>AGENT_NUMBER</kind></searchFields>
> <requestor>NDRS</requestor>
> </searchElectronicDocument>
> </SOAP-ENV:Body></SOAP-ENV:Envelope>
> Detailed Stack trace:
> [12/19/08 15:47:49:581 EST]   d207ad SystemOut     O 15:47:49,580 DEBUG 
> BuilderUtil:312 - Input contentType (text/xml;charset=UTF-8)
> [12/19/08 15:47:49:582 EST]   d207ad SystemOut     O 15:47:49,581 DEBUG 
> BuilderUtil:351 - CharSetEncoding from content-type (UTF-8)
> [12/19/08 15:47:49:583 EST]   d207ad SystemOut     O 15:47:49,582 DEBUG 
> TransportUtils:156 - createSOAPEnvelope using Builder (class 
> org.apache.axis2.builder.ApplicationXMLBuilder) selected from type 
> (application/xml)
> [12/19/08 15:47:49:584 EST]   d207ad SystemOut     O 15:47:49,584 DEBUG 
> StAXUtils:177 - XMLStreamReader is com.ctc.wstx.sr.ValidatingStreamReader
> [12/19/08 15:47:49:586 EST]   d207ad SystemOut     O 15:47:49,585 DEBUG 
> Phase:269 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Checking pre-condition for Phase "Transport"
> [12/19/08 15:47:49:587 EST]   d207ad SystemOut     O 15:47:49,586 DEBUG 
> Phase:282 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking phase "Transport"
> [12/19/08 15:47:49:588 EST]   d207ad SystemOut     O 15:47:49,587 DEBUG 
> Phase:289 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking Handler 'RequestURIBasedDispatcher' in Phase 'Transport'
> [12/19/08 15:47:49:589 EST]   d207ad SystemOut     O 15:47:49,588 DEBUG 
> RequestURIBasedServiceDispatcher:50 - [MessageContext: 
> logID=urn:uuid:9A091E02085FEBA2CF1229719669659] Checking for Service using 
> target endpoint address : 
> http://fir.nwie.net:9087/docaccess/services/SearchElectronicDocumentService
> [12/19/08 15:47:49:590 EST]   d207ad SystemOut     O 15:47:49,589 DEBUG 
> Utils:184 - parseRequestURLForServiceAndOperation : 
> [http://fir.nwie.net:9087/docaccess/services/SearchElectronicDocumentService][/docaccess/services]
> [12/19/08 15:47:49:591 EST]   d207ad SystemOut     O 15:47:49,590 DEBUG 
> ProjectResourceBundle:70 - 
> org.apache.axis2.i18n.resource::handleGetObject(servicefound)
> [12/19/08 15:47:49:592 EST]   d207ad SystemOut     O 15:47:49,591 DEBUG 
> AbstractDispatcher:95 - [MessageContext: 
> logID=urn:uuid:9A091E02085FEBA2CF1229719669659] Found AxisService : 
> SearchElectronicDocumentService
> [12/19/08 15:47:49:596 EST]   d207ad SystemOut     O 15:47:49,592 DEBUG 
> Phase:303 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Checking post-conditions for phase "Transport"
> [12/19/08 15:47:49:597 EST]   d207ad SystemOut     O 15:47:49,596 DEBUG 
> Phase:269 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Checking pre-condition for Phase "Security"
> [12/19/08 15:47:49:598 EST]   d207ad SystemOut     O 15:47:49,597 DEBUG 
> Phase:282 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking phase "Security"
> [12/19/08 15:47:49:598 EST]   d207ad SystemOut     O 15:47:49,598 DEBUG 
> Phase:303 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Checking post-conditions for phase "Security"
> [12/19/08 15:47:49:599 EST]   d207ad SystemOut     O 15:47:49,599 DEBUG 
> Phase:269 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Checking pre-condition for Phase "PreDispatch"
> [12/19/08 15:47:49:600 EST]   d207ad SystemOut     O 15:47:49,600 DEBUG 
> Phase:282 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking phase "PreDispatch"
> [12/19/08 15:47:49:601 EST]   d207ad SystemOut     O 15:47:49,601 DEBUG 
> Phase:303 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Checking post-conditions for phase "PreDispatch"
> [12/19/08 15:47:49:602 EST]   d207ad SystemOut     O 15:47:49,601 DEBUG 
> Phase:269 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Checking pre-condition for Phase "Dispatch"
> [12/19/08 15:47:49:603 EST]   d207ad SystemOut     O 15:47:49,602 DEBUG 
> Phase:282 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking phase "Dispatch"
> [12/19/08 15:47:49:604 EST]   d207ad SystemOut     O 15:47:49,603 DEBUG 
> Phase:289 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking Handler 'SOAPMessageBodyBasedDispatcher' in Phase 'Dispatch'
> [12/19/08 15:47:49:605 EST]   d207ad SystemOut     O 15:47:49,604 DEBUG 
> Phase:289 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking Handler 'RequestURIBasedDispatcher' in Phase 'Dispatch'
> [12/19/08 15:47:49:606 EST]   d207ad SystemOut     O 15:47:49,606 DEBUG 
> Phase:289 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking Handler 'RequestURIOperationDispatcher' in Phase 'Dispatch'
> [12/19/08 15:47:49:608 EST]   d207ad SystemOut     O 15:47:49,607 DEBUG 
> Utils:184 - parseRequestURLForServiceAndOperation : 
> [http://fir.nwie.net:9087/docaccess/services/SearchElectronicDocumentService][/docaccess/services]
> [12/19/08 15:47:49:609 EST]   d207ad SystemOut     O 15:47:49,608 DEBUG 
> RequestURIBasedOperationDispatcher:64 - [MessageContext: 
> logID=urn:uuid:9A091E02085FEBA2CF1229719669659] Attempted to check for 
> Operation using target endpoint URI, but the operation fragment was missing
> [12/19/08 15:47:49:610 EST]   d207ad SystemOut     O 15:47:49,609 DEBUG 
> Phase:289 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking Handler 'HTTPLocationBasedDispatcher' in Phase 'Dispatch'
> [12/19/08 15:47:49:611 EST]   d207ad SystemOut     O 15:47:49,610 DEBUG 
> Phase:303 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Checking post-conditions for phase "Dispatch"
> [12/19/08 15:47:49:612 EST]   d207ad SystemOut     O 15:47:49,612 DEBUG 
> ProjectResourceBundle:70 - 
> org.apache.axis2.i18n.resource::handleGetObject(operationnotfoundforepr)
> [12/19/08 15:47:49:614 EST]   d207ad SystemOut     O 15:47:49,613 DEBUG 
> Phase:315 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking flowComplete() in Phase "PreDispatch"
> [12/19/08 15:47:49:615 EST]   d207ad SystemOut     O 15:47:49,614 DEBUG 
> Phase:315 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking flowComplete() in Phase "Security"
> [12/19/08 15:47:49:615 EST]   d207ad SystemOut     O 15:47:49,615 DEBUG 
> Phase:315 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking flowComplete() in Phase "Transport"
> [12/19/08 15:47:49:616 EST]   d207ad SystemOut     O 15:47:49,616 DEBUG 
> Phase:334 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669659] 
> Invoking flowComplete() for Handler 'RequestURIBasedDispatcher' in Phase 
> 'Transport'
> [12/19/08 15:47:49:617 EST]   d207ad SystemOut     O 15:47:49,617 DEBUG 
> AxisServlet:152 - org.apache.axis2.AxisFault: The endpoint reference (EPR) 
> for the Operation not found is 
> http://fir.nwie.net:9087/docaccess/services/SearchElectronicDocumentService 
> and the WSA Action = null
> [12/19/08 15:47:49:632 EST]   d207ad SystemOut     O 15:47:49,631 DEBUG 
> AddressingHelper:70 - [MessageContext: 
> logID=urn:uuid:9A091E02085FEBA2CF1229719669659] isReplyRedirected: FaultTo is 
> null. Returning isReplyRedirected
> [12/19/08 15:47:49:633 EST]   d207ad SystemOut     O 15:47:49,632 DEBUG 
> AddressingHelper:49 - [MessageContext: 
> logID=urn:uuid:9A091E02085FEBA2CF1229719669659] isReplyRedirected: ReplyTo is 
> null. Returning false
> [12/19/08 15:47:49:635 EST]   d207ad SystemOut     O 15:47:49,634 DEBUG 
> Phase:269 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669709] 
> Checking pre-condition for Phase "MessageOut"
> [12/19/08 15:47:49:636 EST]   d207ad SystemOut     O 15:47:49,635 DEBUG 
> Phase:282 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669709] 
> Invoking phase "MessageOut"
> [12/19/08 15:47:49:637 EST]   d207ad SystemOut     O 15:47:49,636 DEBUG 
> Phase:303 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669709] 
> Checking post-conditions for phase "MessageOut"
> [12/19/08 15:47:49:638 EST]   d207ad SystemOut     O 15:47:49,637 DEBUG 
> ApplicationXMLFormatter:139 - contentType set from messageContext =null
> [12/19/08 15:47:49:639 EST]   d207ad SystemOut     O 15:47:49,638 DEBUG 
> ApplicationXMLFormatter:140 - (NOTE) contentType from format 
> is=multipart/related; 
> boundary=MIMEBoundaryurn_uuid_9A091E02085FEBA2CF1229719669714; 
> type="application/xop+xml"; 
> start="0.urn:uuid:9a091e02085feba2cf1229719669...@apache.org"; 
> start-info="text/xml"
> [12/19/08 15:47:49:640 EST]   d207ad SystemOut     O 15:47:49,639 DEBUG 
> ApplicationXMLFormatter:164 - contentType returned =application/xml; 
> charset=UTF-8
> [12/19/08 15:47:49:641 EST]   d207ad SystemOut     O 15:47:49,640 DEBUG 
> ApplicationXMLFormatter:94 - start writeTo()
> [12/19/08 15:47:49:642 EST]   d207ad SystemOut     O 15:47:49,642 DEBUG 
> StAXUtils:265 - XMLStreamWriter is com.ctc.wstx.sw.SimpleNsStreamWriter
> [12/19/08 15:47:49:645 EST]   d207ad SystemOut     O 15:47:49,644 DEBUG 
> ApplicationXMLFormatter:126 - end writeTo()
> [12/19/08 15:47:49:646 EST]   d207ad SystemOut     O 15:47:49,645 DEBUG 
> TransportUtils:430 - Did not find RequestResponseTransport cannot set 
> response written
> [12/19/08 15:47:49:647 EST]   d207ad SystemOut     O 15:47:49,646 DEBUG 
> Phase:315 - [MessageContext: logID=urn:uuid:9A091E02085FEBA2CF1229719669709] 
> Invoking flowComplete() in Phase "MessageOut"
> [12/19/08 15:47:49:648 EST]   d207ad SystemOut     O 15:47:49,647 DEBUG 
> TransportUtils:476 - Entering deleteAttachments()
> [12/19/08 15:47:49:648 EST]   d207ad SystemOut     O 15:47:49,648 DEBUG 
> TransportUtils:508 - Exiting deleteAttachments()

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to