You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "John F. Berry" <bo...@yahoo.com.INVALID> on 2019/11/04 20:55:16 UTC

Java DSL cxf SOAP call (client)..

OK.. I've tried to google this to death to avoid asking something so embarrassing.. but to no avail..So, without making eye contact with anyone here.. How do I construct a call using cxf and utilizing wsdl2java in Java DSL?  I've had a project that receives a message and decodes a base64 encoded pdf to a filesystem and updates MS SQL with the properties of that action..  Now we are changing systems and the base64 encoded pdf will remain encoded, but marshalled with some data properties placed into XML for a SOAP call.  I have the vendor's WDSL and have defined that in the cxf plugin, I expected to see a code example like:
.encode(??"service name"??).to(cxf:"uri","service")
and that to be it... but everyone with an example (with cxf, wdsl2java, and cxf plug-in) is showing it in spring.  
The WSDL being defined in cxf I would assume would expose my XML fields and the specific "service calls" to simply be referenced..
OK.. I've said that.. I'll go back to my kindergarten room and play blocks now.. Thanks!



Re: Java DSL cxf SOAP call (client)..

Posted by "John F. Berry" <bo...@yahoo.com.INVALID>.
 Thanks Dmitry, 

Yeah, I've seen methods like this.. but we have a massive WSDL like 4.5Mb with hundreds of "services"... and I think we will have a lot more "feeds" that will be sent this way...   So to have elements already defined with what I understand WSDL2Java will provide, I can marshal and send with populating those pre-defined objects and marshal based on service name to send... 

    On Monday, November 4, 2019, 5:15:11 PM EST, Shultz, Dmitry <dm...@kaltire.com> wrote:  
 
 Hey John,

I'm using org.apache.cxf:cxf-codegen-plugin in pom.xml, it builds all the classes in let's say com.somecompany.model package. Then the route looks like this:

SoapJaxbDataFormat soap = new SoapJaxbDataFormat(com.somecompany.model. ServicePort.class.getPackage().getName(), new ServiceInterfaceStrategy(ServicePort.class, true));

from("direct:sendToSoap")
                .marshal(soap)
                .convertBodyTo(String.class)
                .log(LoggingLevel.DEBUG, this.getClass().getName(), "request: ${body}")
                .setHeader(Exchange.CONTENT_TYPE, constant("text/xml"))
                .to("https4:some-company-server/some-ws-endpoint")
                .convertBodyTo(String.class)
                .log(LoggingLevel.DEBUG, this.getClass().getName(), "response: ${body}")
                .unmarshal(soap);

This is probably not the most kosher way of doing this, but it works and is pretty straightforward (and there is no Spring).

Cheers,
Dmitry


-----Original Message-----
From: John F. Berry [mailto:bohnjerry@yahoo.com.INVALID] 
Sent: Monday, November 4, 2019 12:55 PM
To: users@camel.apache.org
Subject: Java DSL cxf SOAP call (client)..

OK.. I've tried to google this to death to avoid asking something so embarrassing.. but to no avail..So, without making eye contact with anyone here.. How do I construct a call using cxf and utilizing wsdl2java in Java DSL?  I've had a project that receives a message and decodes a base64 encoded pdf to a filesystem and updates MS SQL with the properties of that action..  Now we are changing systems and the base64 encoded pdf will remain encoded, but marshalled with some data properties placed into XML for a SOAP call.  I have the vendor's WDSL and have defined that in the cxf plugin, I expected to see a code example like:
.encode(??"service name"??).to(cxf:"uri","service") and that to be it... but everyone with an example (with cxf, wdsl2java, and cxf plug-in) is showing it in spring. The WSDL being defined in cxf I would assume would expose my XML fields and the specific "service calls" to simply be referenced..
OK.. I've said that.. I'll go back to my kindergarten room and play blocks now.. Thanks!


  

RE: Java DSL cxf SOAP call (client)..

Posted by "Shultz, Dmitry" <Dm...@kaltire.com>.
Hey John,

I'm using org.apache.cxf:cxf-codegen-plugin in pom.xml, it builds all the classes in let's say com.somecompany.model package. Then the route looks like this:

SoapJaxbDataFormat soap = new SoapJaxbDataFormat(com.somecompany.model. ServicePort.class.getPackage().getName(), new ServiceInterfaceStrategy(ServicePort.class, true));

from("direct:sendToSoap")
                .marshal(soap)
                .convertBodyTo(String.class)
                .log(LoggingLevel.DEBUG, this.getClass().getName(), "request: ${body}")
                .setHeader(Exchange.CONTENT_TYPE, constant("text/xml"))
                .to("https4:some-company-server/some-ws-endpoint")
                .convertBodyTo(String.class)
                .log(LoggingLevel.DEBUG, this.getClass().getName(), "response: ${body}")
                .unmarshal(soap);

This is probably not the most kosher way of doing this, but it works and is pretty straightforward (and there is no Spring).

Cheers,
Dmitry


-----Original Message-----
From: John F. Berry [mailto:bohnjerry@yahoo.com.INVALID] 
Sent: Monday, November 4, 2019 12:55 PM
To: users@camel.apache.org
Subject: Java DSL cxf SOAP call (client)..

OK.. I've tried to google this to death to avoid asking something so embarrassing.. but to no avail..So, without making eye contact with anyone here.. How do I construct a call using cxf and utilizing wsdl2java in Java DSL?  I've had a project that receives a message and decodes a base64 encoded pdf to a filesystem and updates MS SQL with the properties of that action..  Now we are changing systems and the base64 encoded pdf will remain encoded, but marshalled with some data properties placed into XML for a SOAP call.  I have the vendor's WDSL and have defined that in the cxf plugin, I expected to see a code example like:
.encode(??"service name"??).to(cxf:"uri","service") and that to be it... but everyone with an example (with cxf, wdsl2java, and cxf plug-in) is showing it in spring. The WSDL being defined in cxf I would assume would expose my XML fields and the specific "service calls" to simply be referenced..
OK.. I've said that.. I'll go back to my kindergarten room and play blocks now.. Thanks!