You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by mozahidone <mo...@gmail.com> on 2013/11/05 15:12:23 UTC
Sending XML input to CXF SOAP webservice
Hi guys,
My CXF webservice method receive XML input. The method is getApi:
package com.apro.web.webservice;
import javax.jws.WebParam;
import javax.jws.WebService;
import com.apro.web.service.UserService;
@WebService(endpointInterface = "com.apro.web.webservice.IUserWebService")
public class UserWebService {
private UserService userService;
public void setUserService(UserService userService) {
this.userService = userService;
}
public String getApi(@WebParam(name="name")String name){
return userService.getApi(name);
}
}
The method works fine with String. But I need to input XML string.
Thanks.
--
View this message in context: http://cxf.547215.n5.nabble.com/Sending-XML-input-to-CXF-SOAP-webservice-tp5735954.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Sending XML input to CXF SOAP webservice
Posted by mozahidone <mo...@gmail.com>.
The requirement from client is the XML document will be passed as String. So
I just escape the XML to string.
--
View this message in context: http://cxf.547215.n5.nabble.com/Sending-XML-input-to-CXF-SOAP-webservice-tp5735954p5736077.html
Sent from the cxf-user mailing list archive at Nabble.com.
Sending XML input to CXF SOAP webservice
Posted by Mark Streit <mc...@gmail.com>.
Glen Mazza's web services blog is a good place to start:
http://www.jroller.com/gmazza/entry/blog_article_index
In addition, there is this from the CXF distribution itself:
http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/wsdl_first/
I would recommend reading the articles on Glen's page first. In there, he
emphasizes using Maven over the IDE for this type of work since that
affords a repeatable development process and you're not tied to the way IDE
tools create things.
Mark
On Wed, Nov 6, 2013 at 10:03 AM, Aaron Titus <at...@fwdco.com> wrote:
> There are many many examples published all over the internet for top-down
> web services (this means start from a schema and have it generate classes
> for you.) If you are using an IDE like eclipse, there is even a wizard
> that will walk you through it, and a tutorial for using the wizard is right
> on the eclipse start screen. It might be worth going through it once with
> the wizard and looking at the code before you try it manually yourself.
> Here is a link to the eclipse help, specifically for doing that with CXF:
>
>
> http://help.eclipse.org/indigo/topic/org.eclipse.jst.ws.cxf.doc.user/tasks/create_client.html
>
>
>
>
> *Aaron Titus*
> Senior Software Engineer
> F.W. Davison & Company, Inc.
> 508-747-7261 x245
> atitus@fwdco.com
>
>
>
> On Wed, Nov 6, 2013 at 4:32 AM, mozahidone <mo...@gmail.com> wrote:
>
> > Thanks Aaron. Would you please show any example for me.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://cxf.547215.n5.nabble.com/Sending-XML-input-to-CXF-SOAP-webservice-tp5735954p5735998.html
> > Sent from the cxf-user mailing list archive at Nabble.com.
> >
>
--
Regards,
Mark
Sent from Gmail Mobile on iPhone
Re: Sending XML input to CXF SOAP webservice
Posted by Aaron Titus <at...@fwdco.com>.
There are many many examples published all over the internet for top-down
web services (this means start from a schema and have it generate classes
for you.) If you are using an IDE like eclipse, there is even a wizard
that will walk you through it, and a tutorial for using the wizard is right
on the eclipse start screen. It might be worth going through it once with
the wizard and looking at the code before you try it manually yourself.
Here is a link to the eclipse help, specifically for doing that with CXF:
http://help.eclipse.org/indigo/topic/org.eclipse.jst.ws.cxf.doc.user/tasks/create_client.html
*Aaron Titus*
Senior Software Engineer
F.W. Davison & Company, Inc.
508-747-7261 x245
atitus@fwdco.com
On Wed, Nov 6, 2013 at 4:32 AM, mozahidone <mo...@gmail.com> wrote:
> Thanks Aaron. Would you please show any example for me.
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Sending-XML-input-to-CXF-SOAP-webservice-tp5735954p5735998.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
Re: Sending XML input to CXF SOAP webservice
Posted by mozahidone <mo...@gmail.com>.
Thanks Aaron. Would you please show any example for me.
--
View this message in context: http://cxf.547215.n5.nabble.com/Sending-XML-input-to-CXF-SOAP-webservice-tp5735954p5735998.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: Sending XML input to CXF SOAP webservice
Posted by Aaron Titus <at...@fwdco.com>.
If you are going to send XML within the string parameter, you need to
escape it first, however doing that is really the wrong approach. You
should generate a java object matching the schema for the XML that you are
going to send in (jaxb can do this for you) and then the method would
contain this object as its argument.
*Aaron Titus*
Senior Software Engineer
F.W. Davison & Company, Inc.
508-747-7261 x245
atitus@fwdco.com
On Tue, Nov 5, 2013 at 9:12 AM, mozahidone <mo...@gmail.com> wrote:
> Hi guys,
>
> My CXF webservice method receive XML input. The method is getApi:
>
> package com.apro.web.webservice;
>
> import javax.jws.WebParam;
> import javax.jws.WebService;
>
> import com.apro.web.service.UserService;
>
> @WebService(endpointInterface = "com.apro.web.webservice.IUserWebService")
> public class UserWebService {
>
> private UserService userService;
>
> public void setUserService(UserService userService) {
> this.userService = userService;
> }
>
> public String getApi(@WebParam(name="name")String name){
> return userService.getApi(name);
> }
>
> }
>
> The method works fine with String. But I need to input XML string.
>
>
> Thanks.
>
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Sending-XML-input-to-CXF-SOAP-webservice-tp5735954.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>