This discussion is archived
4 Replies Latest reply: Dec 3, 2012 4:57 AM by CarstenDietzel RSS

Can't handle response of XML-RPC

CarstenDietzel Newbie
Currently Being Moderated
Hello guys,

in a BPEL process I invoke a XML-RPC of the German Federal Central Tax Office, you can find the details with examples here http://evatr.bff-online.de/eVatR/xmlrpc/ (unfortunately just in German).
I use a HTTP binding for this matter and the transform of the input works just fine. After SOAP sends the input parameters to the service I receive the expected values.
But not in the expected form. In this picture http://i.imgur.com/m7ab6.png you can see a part of the response. As you can see, this is some kind of XML. There are two different "value" elements in this scheme, which is pretty bad, I guess. Also the first string element in the second value element contains the name of the first output parameter, the second one its value..

So how would you guys write the xsd for the outcome of the HTTP binding? Or would you go a different way?

If tried a few things, for example this xsd:
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:tns="http://TargetNamespace.com/http"
            targetNamespace="http://TargetNamespace.com/http"
            elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xsd:element name="params">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="param" minOccurs="0" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="value">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="array">
                      <xsd:complexType>
                        <xsd:sequence>
                          <xsd:element name="data">
                            <xsd:complexType>
                              <xsd:sequence>
                                <xsd:element name="value" minOccurs="0"
                                             maxOccurs="unbounded">
                                  <xsd:complexType>
                                    <xsd:sequence>
                                      <xsd:element name="string"
                                                   type="xsd:string"/>
                                    </xsd:sequence>
                                  </xsd:complexType>
                                </xsd:element>
                              </xsd:sequence>
                            </xsd:complexType>
                          </xsd:element>
                        </xsd:sequence>
                      </xsd:complexType>
                    </xsd:element>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
With this transfrom after the invoke
<?xml version="1.0" encoding="UTF-8" ?>
[...]
<xsl:stylesheet version="1.0"  [...]  >
  <xsl:template match="/">
    <ns0:umsatzsteuerIdResponse>
      <ns0:code>
        <xsl:value-of select="/tns:params/tns:param[2]/tns:value/tns:array/tns:data/tns:value[1]/tns:string"/>
      </ns0:code>
      <ns0:ergebnisText>
        <xsl:value-of select='"Text"'/>
      </ns0:ergebnisText>
      <ns0:ergFirma>
        <xsl:value-of select="/tns:params/tns:param[9]/tns:value/tns:array/tns:data/tns:value[1]/tns:string"/>
      </ns0:ergFirma>
      <ns0:ergOrt>
        <xsl:value-of select="/tns:params/tns:param[10]/tns:value/tns:array/tns:data/tns:value[1]/tns:string"/>
      </ns0:ergOrt>
      <ns0:ergPLZ>
        <xsl:value-of select="/tns:params/tns:param[11]/tns:value/tns:array/tns:data/tns:value[1]/tns:string"/>
      </ns0:ergPLZ>
      <ns0:ergAdresse>
        <xsl:value-of select="/tns:params/tns:param[12]/tns:value/tns:array/tns:data/tns:value[1]/tns:string"/>
      </ns0:ergAdresse>
    </ns0:umsatzsteuerIdResponse>
  </xsl:template>
</xsl:stylesheet>
But it just fills the parameter ergebnisText with the string "Text"..obviously..

I really hope my problem is understandable and that you guys can help me. And please excuse my bad English.

Regards,
Carsten

Oracle 11g
BPEL 2.0

Edited by: Carsten Dietzel on 29.11.2012 05:24

Edited by: Carsten Dietzel on 29.11.2012 07:12
  • 1. Re: Can't handle response of XML-RPC
    vladodias Guru
    Currently Being Moderated
    hallo, wie geht's
    Carsten Dietzel wrote:
    But it just fills the parameter ergebnisText with the string "Text"..obviously..
    And what's the requirement?
  • 2. Re: Can't handle response of XML-RPC
    CarstenDietzel Newbie
    Currently Being Moderated
    hallo, mir geht es gut. wie geht es dir? ;-p

    Thank you for your answer. The parameter ergebnisText (which just means something like result) is optional. I filled it just for a test
    in the transform with the string "Text".
    My main problem is the schema of the XSD of the XML. How should it look? Or should I choose a different way to manage the response of the service.
    Here you can see a response with test data: http://evatr.bff-online.de/eVatR/xmlrpc/beispiel

    I still think, the main problem might be the two different elements with the name "value".

    Again, thanks for any help!
  • 3. Re: Can't handle response of XML-RPC
    vladodias Guru
    Currently Being Moderated
    Carsten Dietzel wrote:
    My main problem is the schema of the XSD of the XML. How should it look? Or should I choose a different way to manage the response of the service.
    I don't see any other way... The response is weird indeed... It needs a equally weird schema to handle...
    I still think, the main problem might be the two different elements with the name "value".
    I think you can handle well with [] operator like you've done...
  • 4. Re: Can't handle response of XML-RPC
    CarstenDietzel Newbie
    Currently Being Moderated
    vladodias wrote:
    The response is weird indeed... It needs a equally weird schema to handle...
    Can you give me a hint how the XSD have to look? I ran the XML response through some XSD generators and all of them delivered a similar outcome.
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="params">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="param" maxOccurs="unbounded" minOccurs="0">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="value">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="array">
                          <xs:complexType>
                            <xs:sequence>
                              <xs:element name="data">
                                <xs:complexType>
                                  <xs:sequence>
                                    <xs:element name="value" maxOccurs="unbounded" minOccurs="0">
                                      <xs:complexType>
                                        <xs:sequence>
                                          <xs:element type="xs:string" name="string"/>
                                        </xs:sequence>
                                      </xs:complexType>
                                    </xs:element>
                                  </xs:sequence>
                                </xs:complexType>
                              </xs:element>
                            </xs:sequence>
                          </xs:complexType>
                        </xs:element>
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    I also created an object with the same schema and a transform after the invoke of the HTTP binding. So that BPEL fills the new object with the values of the response.

    This is the transform:
    [...]
     <xsl:template match="/">
        <tns:params>
          <xsl:for-each select="/tns:params/tns:param">
            <tns:param>
              <tns:value>
                <tns:array>
                  <tns:data>
                    <xsl:for-each select="tns:value/tns:array/tns:data/tns:value">
                      <tns:value>
                        <tns:string>
                          <xsl:value-of select="tns:string"/>
                        </tns:string>
                      </tns:value>
                    </xsl:for-each>
                  </tns:data>
                </tns:array>
              </tns:value>
            </tns:param>
          </xsl:for-each>
        </tns:params>
      </xsl:template>
    [...]
    But unfortunately BPEL doesn't fill the new object, here is a part of the flow trace.
    First the response from the HTTP binding:
    <messages>
      <Invoke1_Request-Response_InputVariable>
        <part  name="request">
          <request>
            <tns:UstId_1>DE81....</tns:UstId_1>
            <tns:UstId_2>NL82...</tns:UstId_2>
            <tns:Firmenname/>
            <tns:Ort/>
            <tns:PLZ/>
            <tns:Strasse/>
          </request>
        </part>
      </Invoke1_Request-Response_InputVariable>
      <Invoke1_Request-Response_OutputVariable>
        <part  name="params">
          <params>
            <param>
              <value>
                <array>
                  <data>
                    <value>
                      <string>UstId_1</string>
                    </value>
                    <value>
                      <string>DE81...</string>
                    </value>
                  </data>
                </array>
              </value>
            </param>
            <param>
              <value>
                <array>
                  <data>
                    <value>
                      <string>ErrorCode</string>
                    </value>
                    <value>
                      <string>200</string>
                    </value>
                  </data>
                </array>
              </value>
            </param>
            <param>
              [...16 more param-elements...]
            </param>
          </params>
        </part>
      </Invoke1_Request-Response_OutputVariable>
    </messages>
    And this is the transform:
    <outputVariable>
      <part  name="payload">
        <params/>
      </part>
    </outputVariable>
    So I guess that means that BPEL couldn't find any "param"-elements. So I tried something else. I removed the "for-each"-tag around the "param"-element and tried it again. The result wasn't any better:
    <outputVariable>
      <part  name="payload">
        <params>
          <tns:param>
            <tns:value>
              <tns:array>
                <tns:data/>
              </tns:array>
            </tns:value>
          </tns:param>
        </params>
      </part>
    </outputVariable>
    So I guess now it couldn't find any "value"-elements in the "data"-element, so I removed that "for-each", too:
    <outputVariable>
      <part  name="payload">
        <params>
          <tns:param>
            <tns:value>
              <tns:array>
                <tns:data>
                  <tns:value>
                    <tns:string/>
                  </tns:value>
                </tns:data>
              </tns:array>
            </tns:value>
          </tns:param>
        </params>
      </part>
    </outputVariable>
    Nothing..
    IMHO what is weird is that there's no namespace "tns:" in the "params"-element.

    So I'm very grateful for any bit of help!
    Thank you, guys.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points