<assign fromexpr=.....> failed to pass xml fragment to <invoke inputvariables=....>

  • tripod123
  • 06/02/09
  • Offline
Posted: Wed, 01/27/2010 - 21:37

Hi

<invoke ... inputvariables="inputVariable"  ...> seems not to take the full xml value from <assign fromexpr="an xpath" outputvariable="inputVariable" >

I had 2 simple mashups: TestMashupWsdlClient and TestMashupWsdl.  TesMashupWsdlClient created an input variable from <assign fromexpr=.....> and pass it to mashup TestMashupWsdl. The TestMashupWsdl printed out the input value from TestMashupWsdl Client.

If I used <assign fromvariable="" .... > to add an xml tree to the input variables of the <invoke>, the TestMashupWsdl, the TestMashupWsdl was able to print the full input xml tree.

If used <assign fromexpr=....> , the TestMashupWsdl only printed out the top-level element name of the xml tree with xmlns="".

Is there an known issue with <assign fromexpr=....> and <invoke inputvariables= >?

TestMashupWsdlClient:

<mashup xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.jackbe.com/2008-03-01/EMMLSchema/ ../src/schemas/EMMLSpec.xsd"
      xmlns="http://www.jackbe.com/2008-03-01/EMMLSchema"
      xmlns:macro="http://www.jackbe.com/2008-03-01/EMMLMacro"
      xmlns:testing="testing"
      name = "TestMashupWsdlClient">
     <operation name="invoke">
     <variable name="testInput" type="document" >
       <test xmlns="testing">
          <testItem>1</testItem>
          <testItem>2</testItem>
       </test>
    </variable>
   
    <!--
    <assign fromvariable="testInput" outputvariable="inputToTestMashupWsdl" />
     -->
    
    <assign fromexpr="$testInput/testing:test" outputvariable="inputToTestMashupWsdl" />
    <display message="inputToMashupWsdl before invoke = " variable="inputToTestMashupWsdl" />
     <invoke service="TestMashupWsdl" operation="invoke" inputvariables="inputToTestMashupWsdl" outputvariable="searchRequest" /> 
 
    <output name="soapResponse" type="document">
      <result xmlns="testnamespace" />
    </output>
   
 </operation>  
 </mashup>

 

TestMashupWsdl:

<mashup xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.jackbe.com/2008-03-01/EMMLSchema/ ../src/schemas/EMMLSpec.xsd"
      xmlns="http://www.jackbe.com/2008-03-01/EMMLSchema"
      xmlns:macro="http://www.jackbe.com/2008-03-01/EMMLMacro"
      name = "TestMashupWsdl">
 <operation name="invoke">
    <input name="soapRequest" type="document" />
     <display message="soapRequest = " variable="soapRequest" />
    <output name="soapResponse" type="document">
      <result xmlns="testnamespace" />
    </output>
 </operation>  
 </mashup>

Log when using <assign fromexpr=....>

soapRequest =     <?xml version="1.0" encoding="UTF-8"?>
<test>null</test>

Any ideas?

Thanks in advance
 

 

 

 

 

cfff4
0
Your rating: None

In TestWsdlMashupClient, you

  • smitchell
  • 08/29/08
  • Offline
  • Thu, 01/28/2010 - 16:37

In TestWsdlMashupClient, you have a <display> statement to output the value of the variable assigned with @fromexpr. In your environment, are you getting output from that <display> statement so that you can verify exactly what is populating inputToTestMashupWsdl?

I suspect, but can't directly confirm, that you're experiencing problems because the <assign> statement with @fromexpr creates a node set (in XPath 2 lingo a 'sequence') rather than a document. The difference is kind of subtle, especially when the node set has only 1 node.

I would suggest adding an explicit declaration for that variable to ensure that it is considered a "document". For example:

<variable name="inputToTestMashupWsdl" type="document"/>

And let us know if that doesn't help.

 

Sara, technical writer/jackbe

 


Hi I can confirm Sara's

  • raj
  • 09/22/08
  • Offline
  • Thu, 01/28/2010 - 21:11

Hi

I can confirm Sara's observation that this behavior is due to incompatibility between XML node-set and document types i.e.,  <assign fromexpr="..."/> yields a node-set which then does not map to the document input param type of the invoked service. 

In contast, <assign fromvariable=""/> does a document copy and hence the resulting variable can be sent as well-formed xml doc type to invoked service.

If the need is to dynamically build/transform a document prior to invocation, <constructor/> statement can be explored. <constructor/> results in well-formed XML document types e.g.,

<constructor outputvariable="tmpDoc">

    <foobar>

            {$xyzDoc//*:test}

     </foobar>

</constructor>

Here, the resulting $tmpDoc would be well-formed and suitable for shipment to invoked services.

hth.

raj.  chief masher @ jackbe


Raj. Yes, the constuctor

  • tripod123
  • 06/02/09
  • Offline
  • Mon, 02/01/2010 - 12:35

Raj.

Yes, the constuctor solution did work. Thanks so much.