Hi Daniel,

Thanks for help.  It works now.

Regards,

Miten Mehta
Morgan Stanley | Technology
Block B2, Nirlon Knowledge Park
S T Yadav Rd, Goregaon East
Mumbai 400063
Phone: +91 22 6138-5645
[email protected]



On Fri, Nov 4, 2011 at 12:01 AM, Daniel Kulp <[email protected]> wrote:

> On Thursday, November 03, 2011 6:06:25 PM Miten Mehta wrote:
> > Hi,
> >
> > I am having difficulty in passing paramter to web serivce.  Please see my
> > details of web service below.  I see web service method getting invoked
> but
> > payload is not correctly being set for method parameter.  I am using cxf
> > 2.2.3.
>
> I would strongly suggest updating to a newer version of CXF.  There has
> been a
> lot of fixes in these areas since then and the issue may already be solved.
>
> That said, the request doesn't match the WSDL.  You have:
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>
> and:
> <xsd:element name="Greeter" nillable="true" type="xsd:string" />
>
> Thus, the request would just look like:
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>   <soap:Body xmlns="http://xml.ms.com/ns/myhello/greeter";>
>      <Greeter>Mitenm</Greeter>
>   </soap:Body>
> </soap:Envelope>
>
>
> Dan
>
>
>
> >
> > wsd:
> > --------------------------------------
> >   <?xml version="1.0" ?>
> >  <wsdl:definitions name="GreeterService" targetNamespace="
> > http://xml.ms.com/ns/myhello/greeter"; xmlns:ns1="
> > http://schemas.xmlsoap.org/soap/http"; xmlns:soap="
> > http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:tns="
> > http://xml.ms.com/ns/myhello/greeter"; xmlns:wsdl="
> > http://schemas.xmlsoap.org/wsdl/"; xmlns:xsd="
> > http://www.w3.org/2001/XMLSchema";>
> >  <wsdl:types>
> >  <xsd:schema attributeFormDefault="unqualified"
> > elementFormDefault="qualified" targetNamespace="
> > http://xml.ms.com/ns/myhello/greeter"; xmlns:tns="
> > http://xml.ms.com/ns/myhello/greeter"; xmlns:xsd="
> > http://www.w3.org/2001/XMLSchema";>
> >   <xsd:element name="Greeter" nillable="true" type="xsd:string" />
> >   <xsd:element name="GreeterResponse" nillable="true" type="xsd:string"
> />
> >   </xsd:schema>
> >   </wsdl:types>
> >  <wsdl:message name="Greeter">
> >   <wsdl:part element="tns:Greeter" name="request" />
> >   </wsdl:message>
> >  <wsdl:message name="GreeterResponse">
> >   <wsdl:part element="tns:GreeterResponse" name="GreeterResponse" />
> >   </wsdl:message>
> >  <wsdl:portType name="Greeter">
> >  <wsdl:operation name="Greeter">
> >   <wsdl:input message="tns:Greeter" name="Greeter" />
> >   <wsdl:output message="tns:GreeterResponse" name="GreeterResponse" />
> >   </wsdl:operation>
> >   </wsdl:portType>
> >  <wsdl:binding name="GreeterServiceSoapHttpBinding" type="tns:Greeter">
> >   <soap:binding style="document" transport="
> > http://schemas.xmlsoap.org/soap/http"; />
> >  <wsdl:operation name="Greeter">
> >   <soap:operation soapAction="" style="document" />
> >  <wsdl:input name="Greeter">
> >   <soap:body use="literal" />
> >   </wsdl:input>
> >  <wsdl:output name="GreeterResponse">
> >   <soap:body use="literal" />
> >   </wsdl:output>
> >   </wsdl:operation>
> >   </wsdl:binding>
> >  <wsdl:service name="GreeterService">
> >  <wsdl:port binding="tns:GreeterServiceSoapHttpBinding"
> name="GreeterPort">
> >   <soap:address location="
> > http://localhost:8080/MyHello6/services/greeterService"; />
> >   </wsdl:port>
> >   </wsdl:service>
> >   </wsdl:definitions>
> >
> >
> > Greeter.java
> > -----------------
> > package myhello;
> >
> > import javax.jws.WebMethod;
> > import javax.jws.WebParam;
> > import javax.jws.WebService;
> > import javax.jws.soap.SOAPBinding;
> >
> > import org.apache.cxf.interceptor.InInterceptors;
> >
> > @WebService(targetNamespace = Greeter.NS_URI)
> > @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> > @InInterceptors(interceptors =
> > "org.apache.cxf.interceptor.LoggingInInterceptor")
> > public class Greeter {
> >
> >     public static final String NS_URI = "
> > http://xml.ms.com/ns/myhello/greeter";;
> >
> >     @WebMethod(operationName = "Greeter")
> >     public String greeter(@WebParam(targetNamespace = NS_URI,
> > partName="request")String request) {
> >         return "Hello, " + request;
> >     }
> > }
> >
> > running client using curl
> > -----------------------------------
> > curl -d "`cat a.xml`"
> > http://172.18.33.222:8080/MyHello6/services/greeterService
> > <soap:Envelope
> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
> "><soap:Body><GreeterR
> > esponse xmlns="http://xml.ms.com/ns/myhello/greeter";>Hello,
> >     </GreeterResponse></soap:Body></soap:Envelope>
> >
> >
> > Here is snippet from java logs of web service.
> > Payload:
> > ---------------------------
> > ID: 1
> > Address: /MyHello6/services/greeterService
> > Encoding: ISO-8859-1
> > Content-Type: application/x-www-form-urlencoded
> > Headers: {x-bluecoat-via=[9734D0704E62AED2],
> > content-type=[application/x-www-form-urlencoded],
> connection=[Keep-Alive],
> > via=[1.1 pabcgw04], host=[172.18.33.222:8080],
> > x-forwarded-for=[172.21.211.138], content-length=[261],
> > user-agent=[curl/7.10.6 (i386-redhat-linux-gnu) libcurl/7.10.6
> > OpenSSL/0.9.7a ipv6 zlib/1.1.4],
> > Content-Type=[application/x-www-form-urlencoded], Accept=[image/gif,
> > image/x-xbitmap, image/jpeg, image/pjpeg, */*], pragma=[no-cache]}
> > Payload: <?xml version="1.0" encoding="UTF-8"?>
> > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
> >   <soap:Body xmlns="http://xml.ms.com/ns/myhello/greeter";>
> >     <Greeter>
> >       <request>Mitenm</request>
> >     </Greeter>
> >   </soap:Body>
> > </soap:Envelope>
> > --------------------------------------
> >
> >
> > Regards,
> >
> > Miten Mehta
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog
> Talend - http://www.talend.com
>

Reply via email to