[JBossWS] - Getting ClassCast Exception in case of malformed webservice
by gandulf.k
Hi, i'm using jbowss ws native with validation turned on to ensure the requests and responses are valid. In case of a xml-valid document the validation is working fine and I'm getting validation errors from the validator. But if i'm sending back a totally corrupt xml message, missing closing tags, etc. then i'm getting the following exception which is not very intuitive:
| Caused by: javax.xml.ws.WebServiceException: java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl cannot be cast to org.jboss.ws.core.soap.SOAPElementI
| mpl
| at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:404)
| at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:314)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:172)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:152)
| at $Proxy311.bookOrders(Unknown Source)
| at com.skidata.dta.server.co.v3_0.classic.impl.BookOrdersHelper.invoke(BookOrdersHelper.java:46)
| ... 12 more
| Caused by: java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl cannot be cast to org.jboss.ws.core.soap.SOAPElementImpl
| at org.jboss.ws.core.CommonSOAPBinding.getParameterFromMessage(CommonSOAPBinding.java:894)
| at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:634)
| at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:380)
| at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)
| ... 16 more
|
I digged into the code a little bit and found out that the actual XML parser exception which i'd like to get is ignored because the SOAPMessageUnMarshallerHTTP is creating a MessageFactory with ignoreParseErrors = true. (line 82 in 3.1.1 source)
| MimeHeaders mimeHeaders = getMimeHeaders(metadata);
| soapMsg = getMessageFactory().createMessage(mimeHeaders, inputStream, true);
|
Which catches the Parse Excpetion and simply returns null in case of a parse error.
Is there another way than changing the source code to change this behaviour, because i'd like to use the original distribution and not apatched one which will be a mess to update later...
thanks gandulf
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231537#4231537
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4231537
15 years, 6 months
[JBossWS] - [ERROR] Invalid header
by smartz
I am trying to consume a WSDL using wsconsume from JBossWS-3.1.2.GA, but I am unable to do so, if a wsdl:message/wsdl:part node defines a "type" instead of an "element".
The error I get is:
[wsconsume] Command invoked: org.jboss.wsf.spi.tools.cmd.WSConsume -k -o generated\classes -s generated\src -v wsdl.wsdl
| [wsconsume] parsing WSDL...
| [wsconsume] [ERROR] Invalid header "SoapHeader" in operation Operation: part must specify a "element" attribute
| [wsconsume] line 40 of file:/wsdl.wsdl
Please find the WSDL below. Please note it is a perfectly legal WSDL as per W3C http://www.w3.org/TR/wsdl#_message, and relative XSD, and that other JAX-WS implementations (CXF) consume the WSDL correctly.
<?xml version="1.0" encoding="UTF-8"?>
| <definitions name="wsdl" targetNamespace="http://localhost/service/"
| xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://localhost/service/"
| xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
| <types>
| <schema xmlns="http://www.w3.org/2001/XMLSchema"
| targetNamespace="http://localhost/service/">
| <element name="OperationRequest">
| <complexType>
| <sequence>
| <element name="request" type="string"></element>
| </sequence>
| </complexType>
| </element>
| <element name="OperationResponse">
| <complexType>
| <sequence>
| <element name="response" type="string"></element>
| </sequence>
| </complexType>
| </element>
| <element name="SoapHeader">
| <complexType>
| <sequence>
| <element name="transactionID" type="string" />
| </sequence>
| </complexType>
| </element>
| </schema>
| </types>
|
| <message name="OperationRequest">
| <part name="parameters" element="tns:OperationRequest"></part>
| </message>
| <message name="OperationResponse">
| <part name="parameters" element="tns:OperationResponse"></part>
| </message>
| <message name="SoapHeader">
| <part name="SoapHeader" type="tns:SoapHeader" />
| </message>
|
| <portType name="ServicePort">
| <operation name="Operation">
| <input name="operationRequest" message="tns:OperationRequest" />
| <output name="operationResponse" message="tns:OperationResponse" />
| </operation>
| </portType>
|
| <binding name="Binding" type="tns:ServicePort">
| <soap:binding style="document"
| transport="http://schemas.xmlsoap.org/soap/http" />
| <operation name="Operation">
| <soap:operation soapAction="http://localhost/service/Operation" />
| <input name="operationRequest">
| <soap:body use="literal" />
| <soap:header message="tns:SoapHeader" part="SoapHeader"
| use="literal" />
| </input>
| <output name="operationResponse">
| <soap:body use="literal" />
| <soap:header message="tns:SoapHeader" part="SoapHeader"
| use="literal" />
| </output>
| </operation>
| </binding>
|
| <service name="Service">
| <port name="Port" binding="tns:Binding">
| <soap:address location="http://localhost/service" />
| </port>
| </service>
|
| </definitions>
Is this a bug? Shall I open a JIRA for JBWS?
Thanks in advance for any advice, and kind regards.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231536#4231536
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4231536
15 years, 6 months