You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by xiangqiuzhao <xi...@gmail.com> on 2011/08/21 09:03:18 UTC

i use wsdl file and payload dataFormat, but IllegalArgumentException

CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:test")
                .process(new MyProcessor())
               
.to("cxf://http://localhost:8000/wstest/services/IWSTestService?wsdlURL=IWSTestService.wsdl&dataFormat=PAYLOAD")
                .process(new MyProcessor());
            }
        });
        
        context.start();

        Endpoint endpoint = context.getEndpoint("direct:test");
        Exchange exchange = endpoint.createExchange();
        exchange.getIn().setHeader("operationName",
"getComplexObjectService");
        
        exchange.getIn().setBody(in); //what the body shoud be??
        
        Producer producer = endpoint.createProducer();
        producer.process(exchange);
        System.out.println(exchange.getOut().getBody());

when i run my program, it's exception as:
java.lang.IllegalArgumentException: The PayLoad elements cannot fit with the
message parts of the BindingOperation. Please check the BindingOperation and
PayLoadMessage.

how to set the message body and send to the URI?

my wsdl file is :



--
View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4719896.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by xiangqiuzhao <xi...@gmail.com>.
the service must be provide by CXF when user CxfPayLoad ??

i had search "operationNamespace" in the cxf-module, nothing about it.

i means i should send message like:

<helloServiceRequest>
     <name>fldsjaflkjdsa</name>
</helloServiceRequest> 

not like:

<iws:helloServiceRequest 
xmlns:iws="http://www.wstest.sunyard.com/IWSTestService/">
    <name>xiangqiuzhao</name>
</iws:helloServiceRequest>

it can be do by set operationNamespace or something to do ?

--
View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4730089.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by Willem Jiang <wi...@gmail.com>.
PAYLOAD body is a list of element, you should create the element 
yourself and set it into the PAYLOAD.

On Wed Aug 24 11:48:05 2011, xiangqiuzhao wrote:
> your means i can set message body like
> 
> <helloServiceRequest>
>      <name>fldsjaflkjdsa</name>
> </helloServiceRequest>
> 
> and invoke helloService in remote?
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4729146.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 


Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by xiangqiuzhao <xi...@gmail.com>.
your means i can set message body like 

<helloServiceRequest>
    <name>fldsjaflkjdsa</name>
</helloServiceRequest>

and invoke helloService in remote?

--
View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4729146.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by Willem Jiang <wi...@gmail.com>.
Does you service is provided from CXF ?
There are some unit test in the camel-cxf module that you can take a look.

On 8/24/11 10:11 AM, xiangqiuzhao wrote:
> I set the keys at runtime, but can't find the service in the server.
>
> Exchange exchange = endpoint.createExchange();
> exchange.getIn().setHeader("operationName", "helloService");
> exchange.getIn().setHeader("operationNamespace",
> "http://www.wstest.sunyard.com/IWSTestService/");
> exchange.getIn().setBody(in);
> producer.process(exchange);
>
> the CxfPayLoad body is the helloServiceRequest Element, content like:
>
> <helloServiceRequest>
>      <name>fldsjaflkjdsa</name>
> </helloServiceRequest>
>
> but service server exception with org.apache.cxf.binding.soap.SoapFault:
> Parameter helloServiceRequest does not exist!
>
> i want to send message like this. but what i need to do set others info
> about the service request?
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4728933.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by xiangqiuzhao <xi...@gmail.com>.
I set the keys at runtime, but can't find the service in the server.

Exchange exchange = endpoint.createExchange();
exchange.getIn().setHeader("operationName", "helloService");
exchange.getIn().setHeader("operationNamespace",
"http://www.wstest.sunyard.com/IWSTestService/");
exchange.getIn().setBody(in);
producer.process(exchange);

the CxfPayLoad body is the helloServiceRequest Element, content like:

<helloServiceRequest>
    <name>fldsjaflkjdsa</name>
</helloServiceRequest>

but service server exception with org.apache.cxf.binding.soap.SoapFault:
Parameter helloServiceRequest does not exist!

i want to send message like this. but what i need to do set others info
about the service request?


--
View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4728933.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by Willem Jiang <wi...@gmail.com>.
You can specify the operationName and operationNamespace at the runtime 
by setting the message header with those key.
In most case you don't need to specify the operationNamespace if it is 
same with the ServiceName namespace.

On Tue Aug 23 17:43:44 2011, xiangqiuzhao wrote:
> i need to invoke service operationName decide by program logic.
> 
> so i want to config the URI point the service address and not appoint the
> special operationName.
> 
> but how to know the namespace and the webservice wsdl:message by camel? if i
> appoint the operationName,
> why camel can't know the wsdl:message that i want to send?
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4726155.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang 
Weibo: willemjiang 


Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by xiangqiuzhao <xi...@gmail.com>.
i need to invoke service operationName decide by program logic.

so i want to config the URI point the service address and not appoint the
special operationName.

but how to know the namespace and the webservice wsdl:message by camel? if i
appoint the operationName, 
why camel can't know the wsdl:message that i want to send?

--
View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4726155.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by Willem Jiang <wi...@gmail.com>.
The defaultOperationNameSpace should be defaultOperationNamespace.
I just update the wiki page entry of it.
But this operation should be used with defaultOperationName at the same 
time to help camel-cxf locate the BindingOperationInfo.

On 8/23/11 2:35 PM, xiangqiuzhao wrote:
> thanks, i had make mistake with the namespace, so i debug it in cxf endpoint
> with the exception.
>
> and my code like:
>
>          DocumentBuilderFactory factory =
> DocumentBuilderFactory.newInstance();
>          factory.setNamespaceAware(true);
>          Document doc = factory.newDocumentBuilder().parse("D:/a.xml");
>          Element element = doc.getDocumentElement();
>          body.add(element);
>          CxfPayload in = new CxfPayload(null, body);
>
> and the a.xml content with:
> <?xml version="1.0" encoding="UTF-8"?>
> <iws:helloServiceRequest
> xmlns:iws="http://www.wstest.sunyard.com/IWSTestService/">
>      <name>my name</name>
> </iws:helloServiceRequest>
>
> but my application had MAP context with contains the key with name only.
> so, i don't know how to make the xml content by the map. because i don't
> know the xmlns and PORT name.
>
> so i look at the cxf URI options description, what  the mean with
> defaultOperationNameSpace option?
>
> i use with:
>
> .to("cxf://http://localhost:8000/wsdemo/services/IWSTestService?synchronous=true&"
> +
>
> "wsdlURL=IWSTestService.wsdl&dataFormat=PAYLOAD&defaultOperationNameSpace=http://www.wstest.sunyard.com/IWSTestService/")
>
> but exception with  Exception in thread "main"
> org.apache.camel.FailedToCreateRouteException...Unknown parameters..
>
> my camel version is 2.7.2
>
> i want my xml content look like only:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <helloServiceRequest>
>      <name>my name</name>
> </helloServiceRequest>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4725659.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by xiangqiuzhao <xi...@gmail.com>.
thanks, i had make mistake with the namespace, so i debug it in cxf endpoint
with the exception.

and my code like:

        DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        Document doc = factory.newDocumentBuilder().parse("D:/a.xml");
        Element element = doc.getDocumentElement();  
        body.add(element);
        CxfPayload in = new CxfPayload(null, body);

and the a.xml content with:
<?xml version="1.0" encoding="UTF-8"?>
<iws:helloServiceRequest
xmlns:iws="http://www.wstest.sunyard.com/IWSTestService/">
    <name>my name</name>
</iws:helloServiceRequest>

but my application had MAP context with contains the key with name only. 
so, i don't know how to make the xml content by the map. because i don't
know the xmlns and PORT name.

so i look at the cxf URI options description, what  the mean with
defaultOperationNameSpace option?

i use with:

.to("cxf://http://localhost:8000/wsdemo/services/IWSTestService?synchronous=true&"
+ 
                       
"wsdlURL=IWSTestService.wsdl&dataFormat=PAYLOAD&defaultOperationNameSpace=http://www.wstest.sunyard.com/IWSTestService/")

but exception with  Exception in thread "main"
org.apache.camel.FailedToCreateRouteException...Unknown parameters..

my camel version is 2.7.2

i want my xml content look like only:

<?xml version="1.0" encoding="UTF-8"?>
<helloServiceRequest>
    <name>my name</name>
</helloServiceRequest> 




--
View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4725659.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: i use wsdl file and payload dataFormat, but IllegalArgumentException

Posted by Willem Jiang <wi...@gmail.com>.
You should put the message body with the elements of the parameter,
camel-cxf just point it out the issue.

You can find the example in the camel-cxf wiki page[1].

Please take good look at the camel-cxf example and document before you 
ask this kind of question.

[1]http://camel.apache.org/cxf.html

On 8/21/11 3:03 PM, xiangqiuzhao wrote:
> CamelContext context = new DefaultCamelContext();
> context.addRoutes(new RouteBuilder() {
>              public void configure() throws Exception {
>                  from("direct:test")
>                  .process(new MyProcessor())
>
> .to("cxf://http://localhost:8000/wstest/services/IWSTestService?wsdlURL=IWSTestService.wsdl&dataFormat=PAYLOAD")
>                  .process(new MyProcessor());
>              }
>          });
>
>          context.start();
>
>          Endpoint endpoint = context.getEndpoint("direct:test");
>          Exchange exchange = endpoint.createExchange();
>          exchange.getIn().setHeader("operationName",
> "getComplexObjectService");
>
>          exchange.getIn().setBody(in); //what the body shoud be??
>
>          Producer producer = endpoint.createProducer();
>          producer.process(exchange);
>          System.out.println(exchange.getOut().getBody());
>
> when i run my program, it's exception as:
> java.lang.IllegalArgumentException: The PayLoad elements cannot fit with the
> message parts of the BindingOperation. Please check the BindingOperation and
> PayLoadMessage.
>
> how to set the message body and send to the URI?
>
> my wsdl file is :
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/i-use-wsdl-file-and-payload-dataFormat-but-IllegalArgumentException-tp4719896p4719896.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang