You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Herbert Christy NCS <hc...@ncs.com.sg> on 2005/09/26 11:22:46 UTC
Guideline with schema condition maxOccurs="1"
Hi everyone,
I am developing a Web Services with wsdl described below and would like
to confirm with the AXIS behaviour.
I Invoked the service with the following SOAP request message, and it
returned the result properly.
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<execXQuery
xmlns="http://www.mysite.org/MyWebServices.myws">
<execQry xmlns="">
<MyServices>
<MyServiceName>Svc1</MyServiceName>
<reqElements>
<elements>
<name>Name1</name>
<type>type1</type>
<value1>Hello</value1>
</elements>
</reqElements>
</MyServices>
</execQry>
</execXQuery>
</soapenv:Body>
</soapenv:Envelope>
Next, I modified the the <elements> tag to include multiple <value1>,
eg.
<elements>
<name>Name1</name>
<type>type1</type>
<value1>Hello</value1>
<value1>Yellow</value1>
</elements>
With modified SOAP request message, the AXIS on the service provider
side, took the 2nd <value1>, which is Yellow, to process the request.
>From what it has been declared in the WSDL, the <value1> tag has
maxOccurs="1".
My Questions are:
1. With maxOccurs="1", does AXIS always take only the last value within
same tag?
2. Is this how AXIS handles the restriction on the maxOccurs="1"?
3. Or must it throw an error, since the SOAP request does not follow the
schema rule?
Appreciate if someone could explain more, regarding this.
Thank you.
Herbert
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++
WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
name="MyWebServices"
targetNamespace="http://www.mysite.org/MyWebServices.wsdl"
xmlns:myws="http://www.mysite.org/MyWebServices.myws"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.mysite.org/MyWebServices.wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">My
WebServices</wsdl:documentation>
<wsdl:types>
<xsd:schema
targetNamespace="http://www.mysite.org/MyWebServices.myws"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:myws="http://www.mysite.org/MyWebServices.myws"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="FileObject">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1"
name="filename" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="file"
type="xsd:base64Binary"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="RequestElement">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="name"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="type"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0"
name="value1" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0"
name="value2" type="myws:FileObject"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOf_RequestElement">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="1"
name="elements" type="myws:RequestElement"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MyService">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1"
name="MyServiceName" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="0"
name="reqElements" type="myws:ArrayOf_RequestElement"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOf_MyService">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="1"
name="MyServices" type="myws:MyService"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="execXQuery">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1"
name="execQry" type="myws:ArrayOf_MyService"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="execXQueryResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1"
name="qryResponse" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="execXQueryRequest">
<wsdl:part element="myws:execXQuery" name="request"/>
</wsdl:message>
<wsdl:message name="execXQueryResponse">
<wsdl:part element="myws:execXQueryResponse" name="response"/>
</wsdl:message>
<wsdl:portType name="MyWebServicesPortType">
<wsdl:operation name="execXQuery">
<wsdl:input message="tns:execXQueryRequest"/>
<wsdl:output message="tns:execXQueryResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyWebServicesBinding"
type="tns:MyWebServicesPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="execXQuery">
<soap:operation
soapAction="capeconnect:MyWebServices:MyWebServicesPortType#execXQuery"/
>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyWebServices">
<wsdl:documentation
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">A service to use the X
Service</wsdl:documentation>
<wsdl:port binding="tns:MyWebServicesBinding"
name="MyWebServicesPort">
<soap:address
location="https://localhost:8080/ws121/services/MyWebServices"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>