Groovy/Grails Using WSClient to consume .net web service

Posted by ROb on Stack Overflow See other posts from Stack Overflow or by ROb
Published on 2010-03-29T12:26:57Z Indexed on 2010/03/29 12:33 UTC
Read the original article Hit count: 382

Filed under:
|
|

I'm pretty new to both Grails/Groovy/Web services and i'm consuming a .net web service ..

I have some code connects to the service using grails WS-client plugin :

WebService webService

 def result = {
 def wsdl =  
  ApplicationHolder.application.parentContext.getResource('WEB-INF/productsSoap.wsdl')

def proxy = webService.getClient(wsdl.getURL().toString())
def productTypeListResponse = proxy.ProductTypeList()

}

I also used soapUI to examine the data returned from the web service which gave ..

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
  <ProductTypeListResponse xmlns="http://tempuri.org/">
     <ProductTypeListResult>
        <xs:schema id="ProductTypeListResult" xmlns=""
 xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
           <xs:element name="ProductTypeListResult" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
              <xs:complexType>
                 <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element name="ProductTypeListResult">
                       <xs:complexType>
                          <xs:sequence>
                             <xs:element name="PRD_TypeId" type="xs:int" minOccurs="0"/>
                             <xs:element name="PRD_TypeName" type="xs:string" minOccurs="0"/>
                             <xs:element name="PRD_Type" 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">
           <ProductTypeListResult xmlns="">
              <ProductTypeListResult diffgr:id="ProductTypeListResult1" msdata:rowOrder="0">
                 <PRD_TypeId>2</PRD_TypeId>
                 <PRD_TypeName>ProdType2</PRD_TypeName>
                 <PRD_Type>S</PRD_Type>
              </ProductTypeListResult>
              <ProductTypeListResult diffgr:id="ProductTypeListResult2" msdata:rowOrder="1">
                 <PRD_TypeId>3</PRD_TypeId>
                 <PRD_TypeName>ProdType3</PRD_TypeName>
                 <PRD_Type>C</PRD_Type>
              </ProductTypeListResult>
              <ProductTypeListResult diffgr:id="ProductTypeListResult3" msdata:rowOrder="2">
                 <PRD_TypeId>4</PRD_TypeId>
                 <PRD_TypeName>ProdType4</PRD_TypeName>
              </ProductTypeListResult>
           </ProductTypeListResult>
        </diffgr:diffgram>
     </ProductTypeListResult>
  </ProductTypeListResponse>

> which is a .net dataset ..

So my question is how do i get at the information using my productTypeListResponse ? Can anyone give me a pointer ?

© Stack Overflow or respective owner

Related posts about grails

Related posts about groovy