You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by "ytrewq2002@libero.it" <yt...@libero.it> on 2009/09/28 12:22:43 UTC
invoke external service
hi,
this is the correct soap msg i have to send to an external webservice HelloWs and it works:
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:hello xmlns:ns2="http://hello.netbureau.it/"><name>pippo</name></ns2:hello></soapenv:Body></soapenv:Envelope>
so i try to call with invoke ina bpel process:
valuating FROM expression "{Literal <?xml version="1.0" encoding="UTF-8"?>
<literal xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
<ns2:hello xmlns:ns2="http://hello.netbureau.it/">
<name/>
</ns2:hello>
</literal>}".
This is the firts part of intialize a variable HelloIn that is the input of invoke.
defining a literal for instanciate a message to send is ok but in the second step why when i copy this into the HelloIn variable whose type is hello it give me a different soap message ( ns2: namespace prefix disappear and also the tag name get a bpel namespace..this is not correct!)
ASSIGN Writing variable 'HelloIn' value '<?xml version="1.0" encoding="UTF-8"?>
<message><parameters><hello xmlns="http://hello.netbureau.it/">
<name xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"/>
</hello></parameters></message>'
this is wrong.. why???? so i get a SelectionFailure exception when i try to write into HelloIn..
:(
my wsdl contain <types> <schema....
and elementFormDefault= "unqualified"
instead bpel schema is qualified and so tns:input is the input of bpel process (Caller.bpel), that is:
message><payload><CallerRequest xmlns="http://MyTest.com/Test" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><input xmlns="http://MyTest.com/Test">pippo</input></CallerRequest></payload></message>
Can help me?
this is the bpel:
<process
name="Caller"
targetNamespace="http://hello.netbureau.it/"
xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sxt="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Trace"
xmlns:sxed="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor"
xmlns:tns="http://MyTest.com/Test"
xmlns:ns2="http://hello.netbureau.it/">
<!--schema def for bpel, adding to process tag-->
<!--xsd:schemaLocation="ws_bpel_executable.xsd"-->
<!-- wsdl Caller + partnerLink defintion-->
<import namespace="http://MyTest.com/Test" location="Caller.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<!-- wsdl Ws Helloname + PartenrLinkType definition-->
<import namespace="http://hello.netbureau.it/" location="Helloname.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<!-- xsd xhema for HellonameWs -->
<!--import namespace="http://hello.netbureau.it/" location="Helloname.xsd" importType="http://www.w3.org/2001/XMLSchema"/-->
<partnerLinks>
<partnerLink name="HelloWs" partnerLinkType="ns2:Helloname" partnerRole="WriteHelloMsgRole"/>
<partnerLink name="Caller" partnerLinkType="tns:Caller" myRole="CallerProvider"/>
</partnerLinks>
<variables>
<variable name="CallerOut" messageType="tns:CallerResponseMessage"/>
<variable name="HelloOut" messageType="ns2:helloResponse"/>
<variable name="HelloIn" messageType="ns2:hello" />
<variable name="ProcessIn" messageType="tns:CallerRequestMessage"/>
</variables>
<sequence>
<receive name="ReceiveFromclient"
createInstance="yes"
partnerLink="Caller"
operation="process" xmlns:tns="http://MyTest.com/Test"
portType="tns:Caller"
variable="ProcessIn"/>
<assign name="Assign1">
<copy>
<!-- first part soap message correct-->
<from>
<literal>
<ns2:hello xmlns:ns2="http://hello.netbureau.it/">
<name/>
</ns2:hello>
</literal>
</from>
<!-- second part soap message wrong -->
<to variable="HelloIn" part="parameters"></to>
</copy>
<copy>
<from>$ProcessIn.payload/tns:input</from>
<to>$HelloIn.parameters/name</to>
</copy>
</assign>
<invoke name="InvokeHelloname"
partnerLink="HelloWs"
operation="hello"
portType="ns2:Helloname"
inputVariable="HelloIn"
outputVariable="HelloOut"/>
<assign name="Assign2">
<copy>
<from>
<literal>
<tns:CallerResponse>
<tns:result/>
</tns:CallerResponse>
</literal>
</from>
<to part="payload" variable="CallerOut"/>
</copy>
<copy>
<!-- this is work fine without namespace(it depends on web service response)-->
<from>$HelloOut.parameters/return</from>
<to>$CallerOut.payload/tns:result</to>
</copy>
</assign>
<reply name="ReplyToClient" partnerLink="Caller" operation="process" portType="tns:Caller" variable="CallerOut"/>
</sequence>
</process>
Re: invoke external service
Posted by Tammo van Lessen <tv...@gmail.com>.
Hi,
looks like a namespace issue. The name element you're creating in your
literal-copy is not in the null-namespace but rather in the BPEL
namespace (the default namespace), which is wrong. Try the following
literal assign expression:
<literal>
<ns2:hello xmlns:ns2="http://hello.netbureau.it/">
<name xmlns=""/>
</ns2:hello>
</literal>
HTH,
Tammo
ytrewq2002@libero.it wrote:
> hi,
>
>
> this is the correct soap msg i have to send to an external webservice HelloWs and it works:
>
> <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:hello xmlns:ns2="http://hello.netbureau.it/"><name>pippo</name></ns2:hello></soapenv:Body></soapenv:Envelope>
>
> so i try to call with invoke ina bpel process:
>
> valuating FROM expression "{Literal <?xml version="1.0" encoding="UTF-8"?>
> <literal xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
> <ns2:hello xmlns:ns2="http://hello.netbureau.it/">
> <name/>
> </ns2:hello>
> </literal>}".
>
> This is the firts part of intialize a variable HelloIn that is the input of invoke.
> defining a literal for instanciate a message to send is ok but in the second step why when i copy this into the HelloIn variable whose type is hello it give me a different soap message ( ns2: namespace prefix disappear and also the tag name get a bpel namespace..this is not correct!)
>
> ASSIGN Writing variable 'HelloIn' value '<?xml version="1.0" encoding="UTF-8"?>
> <message><parameters><hello xmlns="http://hello.netbureau.it/">
> <name xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"/>
> </hello></parameters></message>'
>
> this is wrong.. why???? so i get a SelectionFailure exception when i try to write into HelloIn..
>
> :(
>
> my wsdl contain <types> <schema....
> and elementFormDefault= "unqualified"
> instead bpel schema is qualified and so tns:input is the input of bpel process (Caller.bpel), that is:
>
> message><payload><CallerRequest xmlns="http://MyTest.com/Test" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><input xmlns="http://MyTest.com/Test">pippo</input></CallerRequest></payload></message>
>
>
> Can help me?
>
> this is the bpel:
>
> <process
> name="Caller"
> targetNamespace="http://hello.netbureau.it/"
> xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:sxt="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Trace"
> xmlns:sxed="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor"
> xmlns:tns="http://MyTest.com/Test"
> xmlns:ns2="http://hello.netbureau.it/">
>
> <!--schema def for bpel, adding to process tag-->
> <!--xsd:schemaLocation="ws_bpel_executable.xsd"-->
>
> <!-- wsdl Caller + partnerLink defintion-->
> <import namespace="http://MyTest.com/Test" location="Caller.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
> <!-- wsdl Ws Helloname + PartenrLinkType definition-->
> <import namespace="http://hello.netbureau.it/" location="Helloname.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
> <!-- xsd xhema for HellonameWs -->
> <!--import namespace="http://hello.netbureau.it/" location="Helloname.xsd" importType="http://www.w3.org/2001/XMLSchema"/-->
> <partnerLinks>
> <partnerLink name="HelloWs" partnerLinkType="ns2:Helloname" partnerRole="WriteHelloMsgRole"/>
> <partnerLink name="Caller" partnerLinkType="tns:Caller" myRole="CallerProvider"/>
> </partnerLinks>
> <variables>
> <variable name="CallerOut" messageType="tns:CallerResponseMessage"/>
> <variable name="HelloOut" messageType="ns2:helloResponse"/>
> <variable name="HelloIn" messageType="ns2:hello" />
> <variable name="ProcessIn" messageType="tns:CallerRequestMessage"/>
> </variables>
> <sequence>
> <receive name="ReceiveFromclient"
> createInstance="yes"
> partnerLink="Caller"
> operation="process" xmlns:tns="http://MyTest.com/Test"
> portType="tns:Caller"
> variable="ProcessIn"/>
> <assign name="Assign1">
> <copy>
> <!-- first part soap message correct-->
> <from>
> <literal>
> <ns2:hello xmlns:ns2="http://hello.netbureau.it/">
> <name/>
> </ns2:hello>
> </literal>
> </from>
> <!-- second part soap message wrong -->
> <to variable="HelloIn" part="parameters"></to>
> </copy>
> <copy>
> <from>$ProcessIn.payload/tns:input</from>
> <to>$HelloIn.parameters/name</to>
> </copy>
> </assign>
> <invoke name="InvokeHelloname"
> partnerLink="HelloWs"
> operation="hello"
> portType="ns2:Helloname"
> inputVariable="HelloIn"
> outputVariable="HelloOut"/>
> <assign name="Assign2">
> <copy>
> <from>
> <literal>
> <tns:CallerResponse>
> <tns:result/>
> </tns:CallerResponse>
> </literal>
> </from>
> <to part="payload" variable="CallerOut"/>
> </copy>
> <copy>
> <!-- this is work fine without namespace(it depends on web service response)-->
> <from>$HelloOut.parameters/return</from>
> <to>$CallerOut.payload/tns:result</to>
> </copy>
> </assign>
> <reply name="ReplyToClient" partnerLink="Caller" operation="process" portType="tns:Caller" variable="CallerOut"/>
> </sequence>
>
> </process>
>
>
>
>
--
Tammo van Lessen - http://www.taval.de