You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Brian Battersby <br...@rnktel.com> on 2006/01/05 00:23:33 UTC

SOAP Requests using the IO taglib

I am currently able to get the correct data back from our Web Service using
the following taglib data:

 

 

<io:soap

    url="http://216.143.130.38:1080/rnksoapservice.asmx"

    SOAPAction="http://216.143.130.38/GetSubjectStatusList">

 <io:body>

  <SOAP-ENV:Envelope

    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

    <SOAP-ENV:Body>

      <m:GetSubjectStatusList xmlns:m="http://216.143.130.38/"/>

    </SOAP-ENV:Body>

  </SOAP-ENV:Envelope>

 </io:body>

</io:soap>

 

However, the data is just displayed in the HTML page as a raw string.  I
would like to store the data in a parameter in the right structure.  The
structure of the data should be as follows:

 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetSubjectStatusListResponse xmlns="http://216.143.130.38/">
      <GetSubjectStatusListResult>
        <SubjectData>
          <Dnis>long</Dnis>
          <NumConnections>int</NumConnections>
          <NumWaiting>int</NumWaiting>
        </SubjectData>
        <SubjectData>
          <Dnis>long</Dnis>
          <NumConnections>int</NumConnections>
          <NumWaiting>int</NumWaiting>
        </SubjectData>
      </GetSubjectStatusListResult>
    </GetSubjectStatusListResponse>
  </soap:Body>

</soap:Envelope>

 

How can I achieve this using the I/O taglib?

Thank you,
Brian Battersby


Re: SOAP Requests using the IO taglib

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Brian Battersby wrote:

> I need to get the data back in XML format so I can parse out the individual
> elements.  For some reason, I was expecting the above response.  Now I
> didn't write the Web Service.  Do you think that the Web Service is not
> sending back the proper SOAP response?

It *is* in that XML format -- trust me, I tried it -- and you can
see it if you use "view source" :-)

Alternatively, paste this into a file -- call it soap.jsp or
whatever (and I assume you have the JSTL jars installed) --

------------------------------------------------------------------------
<%@ page contentType="text/xml" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/io-1.0" prefix="io" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<c:set var="result">
<io:soap
    url="http://216.143.130.38:1080/rnksoapservice.asmx"
    SOAPAction="http://216.143.130.38/GetSubjectStatusList">
 <io:body>
  <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
      <m:GetSubjectStatusList xmlns:m="http://216.143.130.38/"/>
    </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>
 </io:body>
</io:soap>
</c:set>

${result}
--------------------------------------------------------------------

Open the page in Firefox and you'll see the XML displayed; you'd
normally just see the text because, served as (X)HTML, browsers
don't intrinsically understand tags like "NumConnections"...

HTH,
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                          dream.  code.



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


RE: SOAP Requests using the IO taglib

Posted by Brian Battersby <br...@rnktel.com>.
Thank you for your response Hassan,

The data I am trying to retrieve is in the following format:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetSubjectStatusListResponse xmlns="http://216.143.130.38/">
      <GetSubjectStatusListResult>
        <SubjectData>
          <Dnis>long</Dnis>
          <NumConnections>int</NumConnections>
          <NumWaiting>int</NumWaiting>
        </SubjectData>
        <SubjectData>
          <Dnis>long</Dnis>
          <NumConnections>int</NumConnections>
          <NumWaiting>int</NumWaiting>
        </SubjectData>
      </GetSubjectStatusListResult>
    </GetSubjectStatusListResponse>
  </soap:Body>
</soap:Envelope>

I need to get the data back in XML format so I can parse out the individual
elements.  For some reason, I was expecting the above response.  Now I
didn't write the Web Service.  Do you think that the Web Service is not
sending back the proper SOAP response?

Thank you,
Brian Battersby

-----Original Message-----
From: Hassan Schroeder [mailto:hassan@webtuitive.com] 
Sent: Wednesday, January 04, 2006 7:26 PM
To: Tag Libraries Users List
Subject: Re: SOAP Requests using the IO taglib

Brian Battersby wrote:
> I am currently able to get the correct data back from our Web Service ...

> However, the data is just displayed in the HTML page as a raw string.  I
> would like to store the data in a parameter in the right structure.  The
> structure of the data should be as follows:

If you use "view source" you'll see your data retains its XML tags,
i.e. its structure, so I'm not sure what you're asking for.

Do you want to save the entire result to a variable to manipulate
with XML/XSLT? Or do you just want to display the result visually
as in your text example, with tags appropriately indented, etc.?

-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                          dream.  code.



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: SOAP Requests using the IO taglib

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Brian Battersby wrote:
> I am currently able to get the correct data back from our Web Service ...

> However, the data is just displayed in the HTML page as a raw string.  I
> would like to store the data in a parameter in the right structure.  The
> structure of the data should be as follows:

If you use "view source" you'll see your data retains its XML tags,
i.e. its structure, so I'm not sure what you're asking for.

Do you want to save the entire result to a variable to manipulate
with XML/XSLT? Or do you just want to display the result visually
as in your text example, with tags appropriately indented, etc.?

-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                          dream.  code.



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org