You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by srinivas thallapalli <sr...@gmail.com> on 2011/04/26 16:33:55 UTC
Problem with CXF
Hi All,
I was trying to invoke a webservice with CXF client using dynamic client
approach but failing with following exception
Exception in thread "main" java.lang.RuntimeException:
org.apache.cxf.binding.soap.SoapFault: Unmarshalling Error: cvc-elt.4.3:
Type 'xs:string' is not validly derived from the type definition,
'getAlertDataRequest', of element 'ns2:getAlertDataRequest'.
Caused by: org.apache.cxf.binding.soap.SoapFault: Unmarshalling Error:
cvc-elt.4.3: Type 'xs:string' is not validly derived from the type
definition, 'getAlertDataRequest', of element 'ns2:getAlertDataRequest'.
at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:99)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
at
org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:672)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2254)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2134)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1988)
at
org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:484)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:310)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:262)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:282)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:268)
However the webservice invocation is fine with soapUI.
On investigation I found that, the request (soap) message sent was not
correct:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getAlertDataRequest xmlns:ns2="http://ws.alerts.sbm.savvion.com/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
ebms
</ns2:getAlertDataRequest>
</soap:Body>
</soap:Envelope>
Instead it should be:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getAlertDataRequest xmlns:ns2="http://ws.alerts.sbm.savvion.com/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
<user>ebms</user>
</ns2:getAlertDataRequest>
</soap:Body>
</soap:Envelope>
I am not able to findout, why CXF client request message does not contain
<user> </user> inside </ns2:getAlertDataRequest>.
Any help appreciated.
Thanks
--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4341066.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Problem with CXF
Posted by Aki Yoshida <el...@googlemail.com>.
Hi,
actually, I find both your wsdl and client code to be wrong, but I
suppose your wsdl was simply corrupted when it was pasted into your
mail.
In concrete, your our wsdl document is missing the namespace
declarations for prefixes wsdl, soap, xs, and tns that are used in the
rest of the document.
So, I assume that you had the following declarations in your wsdl
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://alerts.webservice.mbpportal.mbs.mycompany.com/"
Suppose your wsdl had the above declarations, we look at your code.
Your code is wrong because you seem to be filling the structure with
the plain string value instead of filling the complex structure. You
can refer to my example that I posted a few days ago on this thread.
You can just replace the operation qname that I used iin my example
with the following one that matches your wsdl's operation definition.
QName opName = new
QName("http://alerts.webservice.mbpportal.mbs.mycompany.com/",
"getAlertData");
Then, you can get the soap message formartted as:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getAlertDataRequest
xmlns:ns2="http://alerts.webservice.mbpportal.mbs.mycompany.com/">
<user>Anne</user>
</ns2:getAlertDataRequest>
</soap:Body>
</soap:Envelope>
Regards, aki
2011/5/2 srinivas thallapalli <sr...@gmail.com>:
> Hi Aki/Daniel,
>
> Could you please let me know, if there anything wrong with WSDL and client
> code?.
>
> Thanks
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4364053.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
Re: Problem with CXF
Posted by srinivas thallapalli <sr...@gmail.com>.
Hi Aki/Daniel,
Could you please let me know, if there anything wrong with WSDL and client
code?.
Thanks
--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4364053.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Problem with CXF
Posted by srinivas thallapalli <sr...@gmail.com>.
Looks like problem with attachments, wsdl and client pasted below
WSDL :
<wsdl:definitions name="AlertService"
targetNamespace="http://alerts.webservice.mbpportal.mbs.mycompany.com/">
<wsdl:types>
<xs:schema
targetNamespace="http://alerts.webservice.mbpportal.mbs.mycompany.com/"
version="1.0">
<xs:element name="alertData" type="tns:alertData" />
<xs:element name="getAlertDataRequest" type="tns:getAlertDataRequest" />
<xs:element name="getAlertDataResponse" type="tns:getAlertDataResponse"
/>
<xs:element name="searchAlertDataRequest"
type="tns:searchAlertDataRequest" />
<xs:element name="searchAlertDataResponse"
type="tns:searchAlertDataResponse" />
<xs:complexType name="getAlertDataRequest">
<xs:sequence>
<xs:element name="user" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="getAlertDataResponse">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="alertData"
type="tns:alertData" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="alertData">
<xs:sequence>
<xs:element name="alertId" type="xs:long" />
<xs:element name="alertName" type="xs:string" />
<xs:element name="message" type="xs:string" />
<xs:element name="severity" type="xs:string" />
<xs:element name="recipient" type="xs:string" />
<xs:element name="receivedTime" type="xs:long" />
<xs:element name="sender" type="xs:string" />
<xs:element minOccurs="0" name="applicationName"
type="xs:string" />
<xs:element minOccurs="0" name="processInstanceId"
type="xs:long" />
<xs:element minOccurs="0" name="processWorkstepId"
type="xs:long" />
<xs:element minOccurs="0" name="ruleModule" type="xs:string" />
<xs:element minOccurs="0" name="ruleStructureName"
type="xs:string" />
<xs:element minOccurs="0" name="ruleStructureType"
type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="searchAlertDataRequest">
<xs:sequence>
<xs:element name="user" type="xs:string" />
<xs:element maxOccurs="unbounded" minOccurs="0"
name="applicationName" nillable="true" type="xs:string" />
<xs:element block="restriction" maxOccurs="unbounded"
minOccurs="0" name="severity" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="low" />
<xs:enumeration value="medium" />
<xs:enumeration value="high" />
<xs:enumeration value="critical" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element default="-1" minOccurs="0" name="fromDate"
type="xs:long" />
<xs:element default="-1" minOccurs="0" name="toDate"
type="xs:long" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="searchAlertDataResponse">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="alertData"
type="tns:alertData" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="getAlertDataResponse">
<wsdl:part element="tns:getAlertDataResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="searchAlertData">
<wsdl:part element="tns:searchAlertDataRequest" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="searchAlertDataResponse">
<wsdl:part element="tns:searchAlertDataResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getAlertData">
<wsdl:part element="tns:getAlertDataRequest" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="IAlertWebService">
<wsdl:operation name="getAlertData">
<wsdl:input message="tns:getAlertData" name="getAlertData">
</wsdl:input>
<wsdl:output message="tns:getAlertDataResponse"
name="getAlertDataResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="searchAlertData">
<wsdl:input message="tns:searchAlertData" name="searchAlertData">
</wsdl:input>
<wsdl:output message="tns:searchAlertDataResponse"
name="searchAlertDataResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AlertServiceSoapBinding" type="tns:IAlertWebService">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getAlertData">
<soap:operation soapAction="urn:GetAlertData" style="document" />
<wsdl:input name="getAlertData">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="getAlertDataResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="searchAlertData">
<soap:operation soapAction="urn:SearchAlertData" style="document" />
<wsdl:input name="searchAlertData">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="searchAlertDataResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AlertService">
<wsdl:port binding="tns:AlertServiceSoapBinding"
name="AlertServiceImplPort">
<soap:address
location="http://localhost:18793/mbs/cxfws/AlertServiceImplPort" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Client code:
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
//client to be created at application level
Client client =
dcf.createClient("http://localhost:18793/mbs/cxfws/AlertServiceImplPort?wsdl");
client.getOutInterceptors().add(new LoggingOutInterceptor());
client.getInInterceptors().add(new LoggingInInterceptor());
Object[] response = client.invoke("getAlertData", "ebms");
ClassLoader urlCL = response[0].getClass().getClassLoader();
Class<?> respClass =
urlCL.loadClass("com.mycompany.mbs.mbpportal.webservice.alerts.GetAlertDataResponse");
System.out.println(respClass.getName()+"******");
Method m1 = respClass.getMethod("getAlertData");
System.out.println("m1 : " + m1);
Object obj = m1.invoke(response[0]);
System.out.println("response: "+obj);
client.destroy();--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4358418.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Problem with CXF
Posted by srinivas thallapalli <sr...@gmail.com>.
Hi Aki,
Please find the attachment for wsdl file and CXF client that I tried out.
And also copied
the request and response messages below.
Request:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:getAlertDataRequest xmlns:ns2="http://<nabble_a
href="alertservice.wsdl">alertservice.wsdl
http://cxf.547215.n5.nabble.com/file/n4358405/CXFClient.java CXFClient.java
/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">
ebms
</ns2:getAlertDataRequest>
</soap:Body>
</soap:Envelope>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body><ns2:getAlertDataResponse
xmlns:ns2="http://alerts.webservice.mbpportal.mbs.mycompany.com/"/>
</soap:Body>
</soap:Envelope>
Thanks--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4358405.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Problem with CXF
Posted by Aki Yoshida <el...@googlemail.com>.
Hi,
There is a CXF sample project (wsdl_first_dynamic_client) that
illustrates how this basically works, but it doesn't seem to work out
of the box and I needed to adjust a few things. I can clean up this
sample code sometime.
For your case, without seeing how you are actually filling the message
and how your entire wsdl looks like, it's difficult to tell what is
wrong.
To illustrate how your case can be done, I made a small example using
a schema similar to yours.
<wsdl:definitions targetNamespace="http://cxf.apache.org/alert_world_soap_http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://cxf.apache.org/alert_world_soap_http"...>
<wsdl:types>
<schema targetNamespace="http://cxf.apache.org/alert_world_soap_http"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<complexType name="getAlertDataRequest">
<sequence>
<element name="user" type="string"/>
</sequence>
</complexType>
<complexType name="getAlertDataResponse">
<sequence>
<element name="user" type="string"/>
</sequence>
</complexType>
<element name="getAlertDataRequest" type="tns:getAlertDataRequest"/>
<element name="getAlertDataResponse"
type="tns:getAlertDataResponse"/>
</schema>
</wsdl:types>
<wsdl:message name="getAlertDataRequest">
<wsdl:part element="tns:getAlertDataRequest" name="in"/>
</wsdl:message>
<wsdl:message name="getAlertDataResponse">
<wsdl:part element="tns:getAlertDataResponse" name="out"/>
</wsdl:message>
<wsdl:portType name="Alert">
<wsdl:operation name="getAlert">
<wsdl:input message="tns:getAlertDataRequest"
name="getAlertDataRequest"/>
<wsdl:output message="tns:getAlertDataResponse"
name="getAlertDataResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Alert" type="tns:Alert">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getAlert">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="getAlertDataRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getAlertDataResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
..
and then you can fill the message content in the following way:
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
ClientImpl client = (ClientImpl)dcf.createClient("wsdl/alert_world.wsdl");
QName opName = new
QName("http://cxf.apache.org/alert_world_soap_http", "getAlert");
BindingOperationInfo boi =
client.getEndpoint().getEndpointInfo().getBinding().getOperation(opName);
BindingMessageInfo inputMessageInfo = boi.getInput();
List<MessagePartInfo> parts = inputMessageInfo.getMessageParts();
MessagePartInfo partInfo = parts.get(0);
Class<?> partClass = partInfo.getTypeClass();
System.out.println("getAlert.type: " + partClass.getCanonicalName());
Object inputObject = partClass.newInstance();
PropertyDescriptor partPropertyDescriptor = new
PropertyDescriptor("user", partClass);
partPropertyDescriptor.getWriteMethod().invoke(inputObject, "Anne");
System.out.println("Invoking alert...");
Object[] result = client.invoke(opName, inputObject);
and this will get you the following SOAP message:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getAlertDataRequest xmlns="http://cxf.apache.org/alert_world_soap_http">
<user>Anne</user>
</getAlertDataRequest>
</soap:Body>
</soap:Envelope>
regards, aki
2011/4/28 srinivas thallapalli <sr...@gmail.com>:
> Hi Dan,Aki
>
> Thanks for your reply.
>
> I tried with JaxWsDynamicClientFactory also but still same problem. The
> request soap message contains
>
> <ns2:getAlertDataRequest xmlns:ns2="http://ws.alerts.sbm.savvion.com/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
> ebms
> </ns2:getAlertDataRequest>
>
> <user> </user> tag is missing. The following is the corresponding wsdl part
> for getAlertDataRequest
>
> <xs:complexType name="getAlertDataRequest">
> <xs:sequence>
> <xs:element name="user" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4345810.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
Re: Problem with CXF
Posted by srinivas thallapalli <sr...@gmail.com>.
Hi Dan,Aki
Thanks for your reply.
I tried with JaxWsDynamicClientFactory also but still same problem. The
request soap message contains
<ns2:getAlertDataRequest xmlns:ns2="http://ws.alerts.sbm.savvion.com/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
ebms
</ns2:getAlertDataRequest>
<user> </user> tag is missing. The following is the corresponding wsdl part
for getAlertDataRequest
<xs:complexType name="getAlertDataRequest">
<xs:sequence>
<xs:element name="user" type="xs:string"/>
</xs:sequence>
</xs:complexType>
--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4345810.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Problem with CXF
Posted by Daniel Kulp <dk...@apache.org>.
Which "DynamicClientFactory" are you using? If you aren't using the
JaxWsDynamicClientFactory, give that a try. The non-jaxws version has a
bunch of restrictions related to the wrappers that may be kicking in here.
Dan
On Tuesday, April 26, 2011 10:33:55 AM srinivas thallapalli wrote:
> Hi All,
>
> I was trying to invoke a webservice with CXF client using dynamic client
> approach but failing with following exception
>
> Exception in thread "main" java.lang.RuntimeException:
> org.apache.cxf.binding.soap.SoapFault: Unmarshalling Error: cvc-elt.4.3:
> Type 'xs:string' is not validly derived from the type definition,
> 'getAlertDataRequest', of element 'ns2:getAlertDataRequest'.
>
> Caused by: org.apache.cxf.binding.soap.SoapFault: Unmarshalling Error:
> cvc-elt.4.3: Type 'xs:string' is not validly derived from the type
> definition, 'getAlertDataRequest', of element 'ns2:getAlertDataRequest'.
> at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalF
> ault(Soap11FaultInInterceptor.java:75) at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMess
> age(Soap11FaultInInterceptor.java:46) at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMess
> age(Soap11FaultInInterceptor.java:35) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:243) at
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(Ab
> stractFaultChainInitiatorObserver.java:99) at
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage
> (CheckFaultInterceptor.java:69) at
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage
> (CheckFaultInterceptor.java:34) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:243) at
> org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:672) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRespons
> eInternal(HTTPConduit.java:2254) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRespons
> e(HTTPConduit.java:2134) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPCon
> duit.java:1988) at
> org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputSt
> ream.java:47) at
> org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188) at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66) at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639) at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInte
> rceptor.handleMessage(MessageSenderInterceptor.java:62) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
> n.java:243) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:484) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:310) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:262) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:282) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:268)
>
>
>
> However the webservice invocation is fine with soapUI.
>
> On investigation I found that, the request (soap) message sent was not
> correct:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>
> <soap:Body>
>
> <ns2:getAlertDataRequest xmlns:ns2="http://ws.alerts.sbm.savvion.com/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
>
> ebms
>
> </ns2:getAlertDataRequest>
>
> </soap:Body>
>
> </soap:Envelope>
>
>
>
> Instead it should be:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>
> <soap:Body>
>
> <ns2:getAlertDataRequest xmlns:ns2="http://ws.alerts.sbm.savvion.com/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
>
> <user>ebms</user>
>
> </ns2:getAlertDataRequest>
>
> </soap:Body>
>
> </soap:Envelope>
>
>
> I am not able to findout, why CXF client request message does not contain
> <user> </user> inside </ns2:getAlertDataRequest>.
>
> Any help appreciated.
>
> Thanks
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4341066.html
> Sent from the cxf-user mailing list archive at Nabble.com.
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com
Re: Problem with CXF
Posted by srinivas thallapalli <sr...@gmail.com>.
Thanks Aki,
The problem got resolved with client of type CXF sample project
(wsdl_first_dynamic_client).
--
View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4367217.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Problem with CXF
Posted by Aki Yoshida <el...@googlemail.com>.
Hi,
I suspect that there is something wrong or inconsistent with your wsdl
or in the way in which you invoke the call.
The expected SOAP message that you quoted appears actually invalid as
it specifies the schema type of getAlertDataRequest to be xsi:string
inline, although this element has a complex content.
In this regard, atually the serialized message that you say incorrect
is correct, as it containts the simple string content in
getAlertDataRequest.
Could you provide more information?
regards, aki
2011/4/26 srinivas thallapalli <sr...@gmail.com>:
> Hi All,
>
> I was trying to invoke a webservice with CXF client using dynamic client
> approach but failing with following exception
>
> Exception in thread "main" java.lang.RuntimeException:
> org.apache.cxf.binding.soap.SoapFault: Unmarshalling Error: cvc-elt.4.3:
> Type 'xs:string' is not validly derived from the type definition,
> 'getAlertDataRequest', of element 'ns2:getAlertDataRequest'.
>
> Caused by: org.apache.cxf.binding.soap.SoapFault: Unmarshalling Error:
> cvc-elt.4.3: Type 'xs:string' is not validly derived from the type
> definition, 'getAlertDataRequest', of element 'ns2:getAlertDataRequest'.
> at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:75)
> at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:46)
> at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:35)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
> at
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:99)
> at
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:69)
> at
> org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
> at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:672)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2254)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2134)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1988)
> at
> org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:47)
> at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:188)
> at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:484)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:310)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:262)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:282)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:268)
>
>
>
> However the webservice invocation is fine with soapUI.
>
> On investigation I found that, the request (soap) message sent was not
> correct:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>
> <soap:Body>
>
> <ns2:getAlertDataRequest xmlns:ns2="http://ws.alerts.sbm.savvion.com/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
>
> ebms
>
> </ns2:getAlertDataRequest>
>
> </soap:Body>
>
> </soap:Envelope>
>
>
>
> Instead it should be:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>
> <soap:Body>
>
> <ns2:getAlertDataRequest xmlns:ns2="http://ws.alerts.sbm.savvion.com/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">
>
> <user>ebms</user>
>
> </ns2:getAlertDataRequest>
>
> </soap:Body>
>
> </soap:Envelope>
>
>
> I am not able to findout, why CXF client request message does not contain
> <user> </user> inside </ns2:getAlertDataRequest>.
>
> Any help appreciated.
>
> Thanks
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Problem-with-CXF-tp4341066p4341066.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>