Willem,
Here is the CXF code that I use :
package com.xpectis.service.tracker;
import java.util.GregorianCalendar;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.junit.Test;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import junit.framework.Assert;
public class TrackerServiceTest {
private static String ADDRESS = "http://localhost:9000/tracker";
//TrackerService trackerService;
/** The Constant LOG. */
private static final Log LOG =
LogFactory.getLog(TrackerServiceTest.class);
/**
* Test call PostParcel Web Service.
*
* @throws Exception the exception
*/
@Test
public void testPostParcel() throws Exception
{
// Create Client Proxy
ClientProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(TrackParcelEndpoint.class);
factory.setAddress(ADDRESS);
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
TrackParcelEndpoint client = (TrackParcelEndpoint)
factory.create();
// Create InputTrackParcel client
InputTrackParcel parcel = new InputTrackParcel();
parcel.setName("chm");
parcel.setDestination("Brussels");
parcel.setOrigin("Florennes");
//parcel.setDeliveryDate(calendar);
// Call web service
OutputTrackParcel result = client.PostParcel(parcel);
LOG.info("Result : " + result.getReference());
Assert.assertNotNull(result);
}
}
Kind regards,
Charles
willem.jiang wrote:
>
> Hi,
>
> The server side behavior is right (WSDL, SEI) , it can't receive the
> wrapped message.
> Can you show me the client side code which call for the service ?
> I don't know why your client send a wrapped soap message, maybe you use
> a wrong front end.
>
> Willem
>
> cmoulliard wrote:
>> Here is the route configuration in camel :
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xmlns:context="http://www.springframework.org/schema/context"
>> xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint"
>>
>> xsi:schemaLocation="
>> http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>> http://activemq.apache.org/camel/schema/cxfEndpoint
>> http://activemq.apache.org/camel/schema/cxf/cxfEndpoint.xsd
>> http://activemq.apache.org/camel/schema/spring
>> http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
>>
>> <import resource="classpath:META-INF/cxf/cxf.xml" />
>> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
>> />
>> <import
>> resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
>> <import resource="classpath:tracker-core-services.xml" />
>>
>> <cxf:cxfEndpoint id="serviceTracker"
>> address="http://localhost:9000/tracker"
>>
>> serviceClass="com.xpectis.service.tracker.impl.TrackerServiceImpl"
>> />
>>
>> <camelContext id="camel" trace="true"
>> xmlns="http://activemq.apache.org/camel/schema/spring">
>> <route>
>> <from uri="cxf:bean:serviceTracker" />
>> <to uri="bean:tracker" />
>> </route>
>> </camelContext>
>>
>> <bean id="tracker" class="com.xpectis.tracker.bean.ExtractParcel">
>> <property name="saveService" ref="saveService" />
>> </bean>
>>
>> </beans>
>>
>> The WSDL file :
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>> <wsdl:definitions
>> targetNamespace="http://tracker.service.xpectis.com"
>> xmlns="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns:tns="http://tracker.service.xpectis.com"
>> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>
>> <!-- Type definitions for input- and output parameters for webservice
>> -->
>> <wsdl:types>
>> <xsd:schema targetNamespace="http://tracker.service.xpectis.com">
>> <xsd:element name="inputTrackParcel">
>> <xsd:complexType>
>> <xsd:sequence>
>> <xsd:element name="name" type="xsd:string" maxOccurs="1"
>> minOccurs="1"/>
>> <xsd:element name="destination" type="xsd:string"
>> maxOccurs="1"
>> minOccurs="1"></xsd:element>
>> <xsd:element name="origin" type="xsd:string"></xsd:element>
>> <xsd:element name="deliveryDate" type="xsd:date" maxOccurs="1"
>> minOccurs="0"></xsd:element>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:element>
>> <xsd:element name="outputTrackParcel">
>> <xsd:complexType>
>> <xsd:sequence>
>> <xsd:element name="reference" type="xsd:int"/>
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:element>
>> </xsd:schema>
>> </wsdl:types>
>>
>> <!-- Message definitions for input and output -->
>> <wsdl:message name="inputTrackParcel">
>> <wsdl:part element="tns:inputTrackParcel" name="parameters"/>
>> </wsdl:message>
>> <wsdl:message name="outputTrackParcel">
>> <wsdl:part element="tns:outputTrackParcel" name="parameters"/>
>> </wsdl:message>
>>
>> <!-- Port (interface) definitions -->
>> <wsdl:portType name="TrackParcelEndpoint">
>> <wsdl:operation name="PostParcel">
>> <wsdl:input message="tns:inputTrackParcel"/>
>> <wsdl:output message="tns:outputTrackParcel"/>
>> </wsdl:operation>
>> </wsdl:portType>
>>
>> <!-- Port bindings to transports and encoding - HTTP, document literal
>> encoding is used -->
>> <wsdl:binding name="TrackParcelBinding" type="tns:TrackParcelEndpoint">
>> <soap:binding style="document"
>> transport="http://schemas.xmlsoap.org/soap/http"/>
>> <wsdl:operation name="PostParcel">
>> <soap:operation
>> soapAction="http://tracker.service.xpectis.com/PostParcel"/>
>> <wsdl:input>
>> <soap:body parts="parameters" use="literal"/>
>> </wsdl:input>
>> <wsdl:output>
>> <soap:body parts="parameters" use="literal"/>
>> </wsdl:output>
>> </wsdl:operation>
>> </wsdl:binding>
>>
>> <!-- Service definition -->
>> <wsdl:service name="TrackParcelService">
>> <wsdl:port binding="tns:TrackParcelBinding" name="TrackParcelPort">
>> <soap:address location="http://tracker.service.xpectis.com"/>
>> </wsdl:port>
>> </wsdl:service>
>> </wsdl:definitions>
>>
>>
>> The interface :
>>
>> package com.xpectis.service.tracker;
>>
>> import javax.jws.WebMethod;
>> import javax.jws.WebParam;
>> import javax.jws.WebResult;
>> import javax.jws.WebService;
>> import javax.jws.soap.SOAPBinding;
>> import javax.xml.bind.annotation.XmlSeeAlso;
>> import com.xpectis.service.tracker.InputTrackParcel;
>> import com.xpectis.service.tracker.OutputTrackParcel;
>> import com.xpectis.service.tracker.ObjectFactory;
>>
>> /**
>> * This class was generated by Apache CXF 2.1.2
>> * Wed Oct 08 11:05:48 CEST 2008
>> * Generated source version: 2.1.2
>> *
>> */
>>
>> @WebService(targetNamespace = "http://tracker.service.xpectis.com", name
>> =
>> "TrackParcelEndpoint")
>> @XmlSeeAlso({ObjectFactory.class})
>> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>> public interface TrackParcelEndpoint {
>>
>> @WebResult(name = "outputTrackParcel", targetNamespace =
>> "http://tracker.service.xpectis.com", partName = "parameters")
>> @WebMethod(operationName = "PostParcel", action =
>> "http://tracker.service.xpectis.com/PostParcel")
>> public OutputTrackParcel PostParcel(@WebParam(partName =
>> "parameters",
>> name = "inputTrackParcel", targetNamespace =
>> "http://tracker.service.xpectis.com") InputTrackParcel parameters
>> );
>> }
>>
>> And implementation
>>
>> package com.xpectis.service.tracker.impl;
>>
>> import org.apache.commons.logging.Log;
>> import org.apache.commons.logging.LogFactory;
>>
>> import com.xpectis.service.tracker.InputTrackParcel;
>> import com.xpectis.service.tracker.OutputTrackParcel;
>> import com.xpectis.service.tracker.TrackParcelEndpoint;
>>
>> import org.apache.cxf.interceptor.*;
>>
>>
>> /**
>> * The webservice we have implemented.
>> */
>> @InInterceptors(interceptors =
>> "org.apache.cxf.interceptor.LoggingInInterceptor")
>> @OutInterceptors(interceptors =
>> "org.apache.cxf.interceptor.LoggingOutInterceptor")
>> public class TrackerServiceImpl implements TrackParcelEndpoint {
>>
>> private static final Log LOG =
>> LogFactory.getLog(TrackerServiceImpl.class);
>> private static int result = 0;
>>
>> public OutputTrackParcel PostParcel(InputTrackParcel parameters) {
>>
>> OutputTrackParcel response = new OutputTrackParcel();
>> response.setReference(result++);
>> LOG.info("Result : " + result);
>> return response;
>>
>> }
>> }
>>
>>
>>
>>
>>
>>
>>
>> willem.jiang wrote:
>>
>>> Can you show me the SEI file and route configuration ?
>>> It looks like a wrapped and unwrapped issue.
>>>
>>> Willem
>>> cmoulliard wrote:
>>>
>>>> Hi,
>>>>
>>>> I have discovered a small problem between a client created using the
>>>> Client
>>>> ProxyFactoryBean and my webservice running with Apache Camel - CXF
>>>> component.
>>>>
>>>> When the client calls the web service, the ClientProxyFactoryBean class
>>>> of
>>>> CXF generates the following SOAP message :
>>>>
>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>> <soap:Body>
>>>> <ns1:PostParcel xmlns:ns1="http://tracker.service.xpectis.com/">
>>>> <ns2:inputTrackParcel xmlns:ns2="http://tracker.service.xpectis.com">
>>>> <name>chm</name>
>>>> <destination>Brussels</destination>
>>>> <origin>Florennes</origin>
>>>> </ns2:inputTrackParcel>
>>>> </ns1:PostParcel>
>>>> </soap:Body>
>>>> </soap:Envelope>
>>>>
>>>> Unfortunately, the tag <ns1:PostParcel> is not supported by the web
>>>> service
>>>> called in camel. If I remove it and send the message using SOAPUI
>>>> client,
>>>> everything works fine.
>>>>
>>>> How can I solve this problem in Camel CXF component ?
>>>>
>>>> Charles Moulliard
>>>>
>>>> -----
>>>> Enterprise Architect
>>>>
>>>> Xpectis
>>>> 12, route d'Esch
>>>> L-1470 Luxembourg
>>>>
>>>> Phone +352 25 10 70 470
>>>> Mobile +352 621 45 36 22
>>>>
>>>> e-mail : [EMAIL PROTECTED]
>>>> web site : www.xpectis.com www.xpectis.com
>>>> My Blog : http://cmoulliard.blogspot.com/
>>>> http://cmoulliard.blogspot.com/
>>>>
>>>>
>>>
>>>
>>
>>
>> -----
>> Enterprise Architect
>>
>> Xpectis
>> 12, route d'Esch
>> L-1470 Luxembourg
>>
>> Phone +352 25 10 70 470
>> Mobile +352 621 45 36 22
>>
>> e-mail : [EMAIL PROTECTED]
>> web site : www.xpectis.com www.xpectis.com
>> My Blog : http://cmoulliard.blogspot.com/
>> http://cmoulliard.blogspot.com/
>>
>
>
>
-----
Enterprise Architect
Xpectis
12, route d'Esch
L-1470 Luxembourg
Phone +352 25 10 70 470
Mobile +352 621 45 36 22
e-mail : [EMAIL PROTECTED]
web site : www.xpectis.com www.xpectis.com
My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
--
View this message in context:
http://www.nabble.com/Camel-CXF-component-does-not-understand-the-SOAP-message-containing-a-tag-for-the-wsdl%3Aoperation-%21%21%21-tp19881309s22882p19895201.html
Sent from the Camel - Users mailing list archive at Nabble.com.