axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pedro Silveira Vieira da Silva <psi...@dcc.online.pt>
Subject Re: Message element name and documen tstyle service
Date Wed, 07 Feb 2007 13:08:24 GMT
Ok,

so first things first.

I started by defining a beanMapping for Invoicedocument because of a 
message that asked me to.

So my new WSDD goes like this:
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
	xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
	<service name="InvoiceReceiver" style="document">
		<parameter name="className" value="pt.gedi.ws.ReceiveInvoice" />
		<parameter name="allowedMethods" value="receive" />
		<beanMapping qname="myNS:InvoiceDocument"
			xmlns:myNS="urn:ReceiveInvoice"
		 
languageSpecificType="java:oasisNamesSpecificationUblSchemaXsdInvoice2.InvoiceDocument" 
/>
	</service>
</deployment>

And after deploying and access the generated wsdl:

http://localhost:8080/WS/services/InvoiceReceiver?wsdl

I get this message:
- The class oasisNamesSpecificationUblSchemaXsdInvoice2.InvoiceType does 
not contain a default constructor, which is a requirement for a bean 
class.  The class cannot be converted into an xml schema type.  An xml 
schema anyType will be used to define this class in the wsdl file.

Just for explanation InvoiceDocument is in a jar that I generated with 
xmlbeans by reading a xsd that defines an Invoice document. this is from 
UBL - Universal Business Language:
http://docs.oasis-open.org/ubl/os-UBL-2.0/xsd/maindoc/UBL-Invoice-2.0.xsd

So, does this means that I cannot use this beans for document style 
services?


Pedro

Anne Thomas Manes wrote:
> I recommend that you edit the generated WSDL and fix the import, and
> make sure that the invDoc element is properly defined (i.e., not
> xsd:anyType), then gen your service from the WSDL using wsdl2java.
> 
> Anne
> 
> On 2/6/07, Pedro Silveira Vieira da Silva <psilva@dcc.online.pt> wrote:
>> I've created a web service that has a simple function that receives a
>> parameter:
>> package pt.gedi.ws;
>>
>> import oasisNamesSpecificationUblSchemaXsdInvoice2.InvoiceDocument;
>>
>> public class ReceiveInvoice {
>>
>>         public void receive(InvoiceDocument invDoc) {
>>                 doSomething(invDoc);
>>         }
>> }
>>
>>
>> For this service I've created a deploy.wsdd that goes like this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <deployment xmlns="http://xml.apache.org/axis/wsdd/"
>>          xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>>   <service name="InvoiceReceiver" style="document">
>>    <parameter name="className" value="pt.gedi.ws.ReceiveInvoice" />
>>    <parameter name="allowedMethods" value="receive" />
>>   </service>
>> </deployment>
>>
>>
>> Wich in turn gives this wsdl after deployment:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <wsdl:definitions
>> targetNamespace="http://localhost:8080/WS/services/InvoiceReceiver"
>> xmlns:apachesoap="http://xml.apache.org/xml-soap"
>> xmlns:impl="http://localhost:8080/WS/services/InvoiceReceiver"
>> xmlns:intf="http://localhost:8080/WS/services/InvoiceReceiver"
>> xmlns:tns1="http://oasisNamesSpecificationUblSchemaXsdInvoice2"
>> xmlns:tns2="http://ws.gedi.pt"
>> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> <!--WSDL created by Apache Axis version: 1.4
>> Built on Apr 22, 2006 (06:55:48 PDT)-->
>>   <wsdl:types>
>>    <schema elementFormDefault="qualified"
>> targetNamespace="http://ws.gedi.pt"
>> xmlns="http://www.w3.org/2001/XMLSchema">
>>     <import The first
>> thnamespace="http://oasisNamesSpecificationUblSchemaXsdInvoice2"/>
>>     <element name="invDoc" type="xsd:anyType"/>
>>    </schema>
>>   </wsdl:types>
>>     <wsdl:message name="receiveResponse">
>>     </wsdl:message>
>>     <wsdl:message name="receiveRequest">
>>        <wsdl:part element="tns2:invDoc" name="invDoc"/>
>>     </wsdl:message>
>>     <wsdl:portType name="ReceiveInvoice">
>>        <wsdl:operation name="receive" parameterOrder="invDoc">
>>           <wsdl:input message="impl:receiveRequest" 
>> name="receiveRequest"/>
>>           <wsdl:output message="impl:receiveResponse"
>> name="receiveResponse"/>
>>        </wsdl:operation>
>>     </wsdl:portType>
>>     <wsdl:binding name="InvoiceReceiverSoapBinding"
>> type="impl:ReceiveInvoice">
>>        <wsdlsoap:binding style="document"
>> transport="http://schemas.xmlsoap.org/soap/http"/>
>>        <wsdl:operation name="receive">
>>           <wsdlsoap:operation soapAction=""/>
>>           <wsdl:input name="receiveRequest">
>>              <wsdlsoap:body use="literal"/>
>>           </wsdl:input>
>>           <wsdl:output name="receiveResponse">
>>              <wsdlsoap:body use="literal"/>
>>           </wsdl:output>
>>        </wsdl:operation>
>>     </wsdl:binding>
>>     <wsdl:service name="ReceiveInvoiceService">
>>        <wsdl:port binding="impl:InvoiceReceiverSoapBinding"
>> name="InvoiceReceiver">
>>           <wsdlsoap:address
>> location="http://localhost:8080/WS/services/InvoiceReceiver"/>
>>        </wsdl:port>
>>     </wsdl:service>
>> </wsdl:definitions>
>>
>>
>> If I do a reload on the wsdl the line:
>>
>> <import namespace="http://oasisNamesSpecificationUblSchemaXsdInvoice2"/>
>>
>> disappears... and in the logs appears this:
>>
>> - The class oasisNamesSpecificationUblSchemaXsdInvoice2.InvoiceDocument
>> does not contain a default constructor, which is a requirement for a
>> bean class.  The class cannot be converted into an xml schema type.  An
>> xml schema anyType will be used to define this class in the wsdl file.
>>
>> Can't use a bean as a parameter in the receive method?
>>
>> What my client does is to build an InvoiceDocument type document and
>> send it to InvoceReceiver service.
>>
>> If you print a sample document before sendig what you get is:
>> <Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
>> xmlns:urn="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">

>>
>>    <urn:IssueDate>2007-02-06+00:00</urn:IssueDate>
>> </Invoice>
>>
>> But when I invoke the service I get:
>>
>> AxisFault
>>   faultCode: {http://xml.apache.org/axis/}Client
>>   faultSubcode:
>>   faultString: No such operation 'Invoice'
>>   faultActor:
>>   faultNode:
>>   faultDetail:
>>         {http://xml.apache.org/axis/}hostname:kheijo
>>
>> No such operation 'Invoice'
>>         at
>> org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222) 
>>
>>         at
>> org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129) 
>>
>>         at
>> org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)

>>
>>         at
>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)

>>
>>         at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1772)

>>
>>         at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2923)

>>
>>         at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645)

>>
>>         at
>> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)

>>
>>         at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508)

>>
>>         at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)

>>
>>         at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)

>>
>>         at
>> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107) 
>>
>>         at
>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)

>>
>>         at
>> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)

>>
>>         at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
>>         at
>> org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)

>>
>>         at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>>         at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
>>         at
>> org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)

>>
>>         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>         at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
>>         at org.apache.axis.client.Call.invoke(Call.java:2767)
>>         at org.apache.axis.client.Call.invoke(Call.java:1792)
>>         at pt.gedi.ws.client.SendInvoice.send(SendInvoice.java:22)
>>         at ubl.CreateInvoice.main(CreateInvoice.java:17)
>>
>> Why is it looking for a operation with name "Invoice" ??? It is clearly
>> specified that the operation is receive, either in service client and
>> server.
>>
>>
>> Thanks in advance,
>> Pedro Silva
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 

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


Mime
View raw message