I have created a Quotations web service, which when passed some
parameters (or no parameters) returns a Quotation type (consisting of
quote, author, subject, and source).
I've had a simple version running for a while with clients in
php/perl/python/jsp, where call to url would return simple quote string.
It works fine.
Except now I need to return a complex type. This worked by adding a
beanMapping to my .wsdd file for service.
However...the format of the returned soap message seems a little too
verbose. I was expecting a simple xml document-like type being returned
and what I get in my soap response is much larger than this...it even
broke it out into a separate multiRef element inside the envelope body.
When I check other samples of returned soap messages...they seem
cleaner/tighter/smaller.
I'm not really sure how I can tie in the Quotation xmlSchema type I
created into the soap response. I think this is why the response is so
bloated.
Could someone give me a pointer about how to clean this up? Does my
.wsdd file need some changes? To reference my xmlSchema type?
JavaClasses
========
QuotationService.class...interface for GetQuotation impl class
GetQuotation.class.........service implementation class
Quotation.class...............bean w/getters/setters representing an
actual Quotation
Quotation.dtd.................XMLSchema type representing an actual
Quotation (mirrors Java Bean)
QuotationService WSDD
=================
<deployment name="quotationService"
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="urn:QuotationService" provider="java:RPC">
<parameter name="className" value="GetQuotation"/>
<parameter name="allowedMethods" value="getQuotation
getQuotationByAuthor getQuotationBySubject getQuotationBySource
getQuotationByClause"/>
<beanMapping qname="QuotationService:Quotation"
xmlns:QuotationService="urn:BeanService"
languageSpecificType="java:Quotation"/>
</service>
</deployment>
Returned SOAP Message
==================
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
<soapenv:Body>
<ns1:getQuotationResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="urn:QuotationService">
<ns1:getQuotationReturn href="#id0"/>
</ns1:getQuotationResponse>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:Quotation"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns2="urn:BeanService">
<author xsi:type="ns3:string"
xmlns:ns3="http://www.w3.org/2001/XMLSchema">Benjamin Franklin</author>
<quote xsi:type="ns4:string"
xmlns:ns4="http://www.w3.org/2001/XMLSchema">Experience keeps a dear
school, yet fools will learn in no other.</quote>
<source xsi:type="ns5:string"
xmlns:ns5="http://www.w3.org/2001/XMLSchema">Poor Richard's
Almanack, 1743</source>
<subject xsi:type="ns6:string"
xmlns:ns6="http://www.w3.org/2001/XMLSchema">education</subject>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
- Re: Problems in format of returned complex type...how... Mike Klein
- Re: Problems in format of returned complex type.... Sanjay Krishnamurthi
