Topic
2 replies Latest Post - ‏2013-02-08T00:06:14Z by AnthonyinPortland
AnthonyinPortland
AnthonyinPortland
7 Posts
ACCEPTED ANSWER

Pinned topic Any Experience With Diffgram Processing?

‏2011-12-14T15:43:09Z |
I'm working with a .net Web Service API that returns some results as Diffgrams. Unfortunately, this means when I map an output from Cast Iron Studio the diffgram portion in the "body" is an "any{}" element with an "occurrence" child. I get the sense that I should substitute the any node with something, but I'm new at Cast Iron and I haven't been able to make sense of how that would work.

To give some context around what the service returns, here is a sample:

<soap:Body>
<GetSalesRepsResponse xmlns="http://compuware.com/changepoint/CPWebService/Opportunity">
...
<value>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="ResourceID" msdata:DataType="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" type="xs:string" minOccurs="0"/>
<xs:element name="Name" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<NewDataSet xmlns="">
<Table diffgr:id="Table1" msdata:rowOrder="0">
<ResourceID>e7746996-7fb5-41bf-9b81-7e680d34213a</ResourceID>
<Name>FirstName LastName</Name>
</Table>
</NewDataSet>
</diffgr:diffgram>
</value>
</GetSalesRepsResult>
</GetSalesRepsResponse>
</soap:Body>

My current plan is to deep copy the results and parse it with XSLT, but I think there must be a better way. If anyone has any advice or experience with this, I'd appreciate the help. Thanks!
Updated on 2013-02-08T00:06:14Z at 2013-02-08T00:06:14Z by AnthonyinPortland
  • SystemAdmin
    SystemAdmin
    1250 Posts
    ACCEPTED ANSWER

    Re: Any Experience With Diffgram Processing?

    ‏2012-10-23T03:15:36Z  in response to AnthonyinPortland
    Hi Anthony, did you find a solution for this? I got the same problem, and couldn't find a way to solve this.Are there any suggestions? Thanks
    • AnthonyinPortland
      AnthonyinPortland
      7 Posts
      ACCEPTED ANSWER

      Re: Any Experience With Diffgram Processing?

      ‏2013-02-08T00:06:14Z  in response to SystemAdmin
      Was searching for something else and saw this...3 months late, but may help someone else.

      the only solution i came up with was XSLT - in my case I'm doing a simple xsl:template match="/" and xsl:copy-of select="//*:NewDataSet/Table" to return the table and go from there. I filter and profile the results for what I need.

      It's not elegant, but it works.

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
      <xsl:template match="/">
      <xsl:copy-of select="//*:NewDataSet/Table "/>
      </xsl:template>
      </xsl:stylesheet>