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 St...@astrazeneca.com on 2005/12/14 11:43:36 UTC

complex type/simple type NEED URGENT HELP

Hi!

When a defining the "message" for a method, I am supposed to enter "parts",
which in turns defines the parameters that should be passed to the method.

If I wish to send two string parameters in a document literal wrapped style
wsdl, should I define the passed strings as "complex type" or "simple type"?
Is there another way of defining the strings that are to be passed to the
method?

If the proper way to do it is to define simple types, am I required to
define one 

<s:element name="string">
	<s:simpleType>
		<s:restriction base="s:string"/>
	</s:simpleType>
</s:element>

per argument in a method, or can I reuse the "string" from <s:element
name="string"> 3 times in a method that requires 3 arguments?

for example:

Will this work:

<s:element name="string">
	<s:simpleType>
		<s:restriction base="s:string"/>
	</s:simpleType>
</s:element>

....


<message name="getPropertyValueRequest">
		<part name="userName" element="s0:string"/>
		<part name="property" element="s0:string"/>
		<part name="property" element="s0:string"/>

</message>




Or is this required:

<s:element name="string">
	<s:simpleType>
		<s:restriction base="s:string"/>
	</s:simpleType>
</s:element>


<s:element name="string">
	<s:simpleType>
		<s:restriction base="s:string1"/>
	</s:simpleType>
</s:element>


<s:element name="string">
	<s:simpleType>
		<s:restriction base="s:string2"/>
	</s:simpleType>
</s:element>

.....


<message name="getPropertyValueRequest">
		<part name="userName" element="s0:string"/>
		<part name="property" element="s0:string1"/>
		<part name="property" element="s0:string2"/>

</message>



I'm attaching my wsdl below:



Regards,

Stefan



<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:s0="http://cleartrust.axis.admin/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:authheader="http://security.astrazeneca.com/admin/authheader"
targetNamespace="http://cleartrust.axis.admin/">
	<types>
		<s:schema elementFormDefault="qualified"
targetNamespace="http://cleartrust.axis.admin/">
			<s:element name="getGroups">
				<s:complexType>
					<s:sequence/>
				</s:complexType>
			</s:element>
			<s:element name="stringArray">
				<s:complexType>
					<s:sequence>
						<s:element minOccurs="0"
maxOccurs="unbounded" name="item" type="s:string"/>
					</s:sequence>
				</s:complexType>
			</s:element>
			<s:element name="string">
				<s:simpleType>
					<s:restriction base="s:string"/>
				</s:simpleType>
			</s:element>
				<s:element name="string1">
				<s:simpleType>
					<s:restriction base="s:string"/>
				</s:simpleType>
			</s:element>
			<!-- this WSDL artifact is not WS-I BP1.0 compliant,
but is necessary to enable AXIS to serialize properly -->
		</s:schema>
		<s:schema elementFormDefault="qualified"
targetNamespace="http://security.astrazeneca.com/admin/authheader">
			<s:element name="AuthenticationHeader">
				<s:complexType>
					<s:sequence>
						<s:element name="username"
type="s:string"/>
						<s:element name="password"
type="s:string"/>
						<s:element name="admingroup"
type="s:string"/>
						<s:element name="adminrole"
type="s:string"/>
					</s:sequence>
				</s:complexType>
			</s:element>
		</s:schema>
	</types>
	<message name="AuthenticationHeader">
		<part name="AuthenticationHeader"
element="authheader:AuthenticationHeader"/>
	</message>
	<message name="getGroupsRequest"/>
	<message name="getGroupsResponse">
		<part name="parameters" element="s0:stringArray"/>
	</message>
	<message name="getEntitlementsForGroupRequest">
		<part name="groupName" element="s0:string"/>
	</message>
	<message name="getEntitlementsForGroupResponse">
		<part name="parameters" element="s0:stringArray"/>
	</message>
	<message name="getEntitlementsForUserRequest">
		<part name="userName" element="s0:string"/>
	</message>
	<message name="getEntitlementsForUserResponse">
		<part name="userName" element="s0:stringArray"/>
	</message>
	<message name="getMemberGroupsRequest">
		<part name="groupName" element="s0:string"/>
	</message>
	<message name="getMemberGroupsResponse">
		<part name="parameters" element="s0:stringArray"/>
	</message>
	<message name="getPropertiesForUserRequest">
		<part name="userName" element="s0:string"/>
	</message>
	<message name="getPropertiesForUserResponse">
		<part name="parameters" element="s0:stringArray"/>
	</message>
	<message name="getPropertyValueRequest">
		<part name="userName" element="s0:string"/>
		<part name="property" element="s0:string1"/>
	</message>
	<message name="getPropertyValueResponse">
		<part name="parameters" element="s0:stringArray"/>
	</message>
	<portType name="axisWebServiceAdmin">
		<operation name="getGroups">
			<documentation>Method that returns all the groups in
the active directory.</documentation>
			<input message="s0:getGroupsRequest"/>
			<output message="s0:getGroupsResponse"/>
		</operation>
		<operation name="getEntitlementsForGroup">
			<documentation>Method that returns all the
entitlements for a group.</documentation>
			<input message="s0:getEntitlementsForGroupRequest"/>
			<output
message="s0:getEntitlementsForGroupResponse"/>
		</operation>
		<operation name="getEntitlementsForUser">
			<documentation>Method that returns all the
entitlements for a user.</documentation>
			<input message="s0:getEntitlementsForUserRequest"/>
			<output
message="s0:getEntitlementsForUserResponse"/>
		</operation>
		<operation name="getMemberGroups">
			<documentation>Method that returns all the
entitlements for a user.</documentation>
			<input message="s0:getMemberGroupsRequest"/>
			<output message="s0:getMemberGroupsResponse"/>
		</operation>
		<operation name="getPropertiesForUser">
			<documentation>Method that returns a users
properties as defined in ClearTrust.</documentation>
			<input message="s0:getPropertiesForUserRequest"/>
			<output message="s0:getPropertiesForUserResponse"/>
		</operation>
		<operation name="getPropertyValue">
			<documentation>Method that returns the value for
requsted property.</documentation>
			<input message="s0:getPropertyValueRequest"/>
			<output message="s0:getPropertyValueResponse"/>
		</operation>
	</portType>
	<binding name="axisWebServiceAdmin" type="s0:axisWebServiceAdmin">
		<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
		<operation name="getGroups">
			<soap:operation
soapAction="http://cleartrust.axis.admin/getGroups" style="document"/>
			<input>
				<soap:body use="literal"/>
				<soap:header
message="s0:AuthenticationHeader" part="AuthenticationHeader"
use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>
		<operation name="getEntitlementsForGroup">
			<soap:operation
soapAction="http://cleartrust.axis.admin/getEntitlementsForGroup"
style="document"/>
			<input>
				<soap:body use="literal"/>
				<soap:header
message="s0:AuthenticationHeader" part="AuthenticationHeader"
use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>
	
		<operation name="getEntitlementsForUser">
			<soap:operation
soapAction="http://cleartrust.axis.admin/getEntitlementsForUser"
style="document"/>
			<input>
				<soap:body use="literal"/>
				<soap:header
message="s0:AuthenticationHeader" part="AuthenticationHeader"
use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>
		<operation name="getMemberGroups">
			<soap:operation
soapAction="http://cleartrust.axis.admin/getMemberGroups" style="document"/>
			<input>
				<soap:body use="literal"/>
				<soap:header
message="s0:AuthenticationHeader" part="AuthenticationHeader"
use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>
		<operation name="getPropertiesForUser">
			<soap:operation
soapAction="http://cleartrust.axis.admin/getPropertiesForUser"
style="document"/>
			<input>
				<soap:body use="literal"/>
				<soap:header
message="s0:AuthenticationHeader" part="AuthenticationHeader"
use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>
		<operation name="getPropertyValue">
			<soap:operation
soapAction="http://cleartrust.axis.admin/getPropertyValue"
style="document"/>
			<input>
				<soap:body use="literal"/>
				<soap:header
message="s0:AuthenticationHeader" part="AuthenticationHeader"
use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>
	</binding>
	<service name="axisWebServiceAdmin">
		<!-- port name becomes the name used in the URL on the
AXIS/server side. -->
		<port name="axisWebServiceAdmin"
binding="s0:axisWebServiceAdmin">
			<soap:address
location="http://seso-odx224225.emea.astrazeneca.net:8080/axis/services/axis
WebServiceAdmin"/>
		</port>
	</service>
</definitions>



Re: complex type/simple type NEED URGENT HELP

Posted by Anne Thomas Manes <at...@gmail.com>.
When using document style, you are supposed to pass a document, not a set of
parameters. Therefore, with document style, your message should contain at
most one body part. (This isn't clearly defined in the SOAP and WSDL
specifications, but it has been defined as a rule in the WS-I Basic
Profile.)

The wrapped convention allows you to define a document/literal service that
simulates RPC style from the programming perspective. In other words, it
lets your application use an interface that accepts a method with a set of
parameters. But the WSDL must still be defined according to the document
style rules (i.e., one body part).

Rather than defining the parameters as parts in the message, instead you
define the parameters as elements within a complex type. (The names of the
elements come from the schema, not from the w:part description.) For
example, if you want to send two string parameters, you would define them
like this:

<s:element name="getPropertyValue">
  <s:complexType>
    <s:sequence>
      <s:element name="userName" type="s:string"/>
      <s:element name="property" type="s"string"/>
    </s:sequence>
  </s:complexType>
</s:element>

 Or, if you prefer to treat the parameters as an array of two strings, you
could define them like this:

<s:element name="getPropertyValue">
  <s:complexType>
    <s:sequence>
      <s:element name="property" type="s:string"
          minOccurs="2" maxOccurs="2"/>
    </s:sequence>
  </s:complexType>
</s:element>

 If the parameters are essentially interchangeable, then it would make sense
to define them as an array. But if the parameters represent different types
of information, then you should give them unique names.

In any case, you define your input message like this:

<w:message name="getPropertyValueRequest">
  <w:part name="parameters" element="s0:getPropertyValue"/>
</w:message>

You should definitely not do this:

<s:element name="string">
       <s:simpleType>
               <s:restriction base="s:string"/>
       </s:simpleType>
</s:element>

 Unless you intend to restrict the "s:string" type.

And this would produce an error:

<s:element name="string">
       <s:simpleType>
               <s:restriction base="s:string1"/>
       </s:simpleType>
</s:element>

 because there is no such type as "s:string1". (I noticed in your WSDL,
though that you named the element "string1" rather than the restricted type,
so perhaps this is a typo.)

In general, it's always better to use standard XSD types unless you need to
restrict or extend them.

Anne


On 12/14/05, Stefan.Freyhult@astrazeneca.com <
Stefan.Freyhult@astrazeneca.com> wrote:
>
> Hi!
>
> When a defining the "message" for a method, I am supposed to enter
> "parts",
> which in turns defines the parameters that should be passed to the method.
>
> If I wish to send two string parameters in a document literal wrapped
> style
> wsdl, should I define the passed strings as "complex type" or "simple
> type"?
> Is there another way of defining the strings that are to be passed to the
> method?
>
> If the proper way to do it is to define simple types, am I required to
> define one
>
> <s:element name="string">
>         <s:simpleType>
>                 <s:restriction base="s:string"/>
>         </s:simpleType>
> </s:element>
>
> per argument in a method, or can I reuse the "string" from <s:element
> name="string"> 3 times in a method that requires 3 arguments?
>
> for example:
>
> Will this work:
>
> <s:element name="string">
>         <s:simpleType>
>                 <s:restriction base="s:string"/>
>         </s:simpleType>
> </s:element>
>
> ....
>
>
> <message name="getPropertyValueRequest">
>                 <part name="userName" element="s0:string"/>
>                 <part name="property" element="s0:string"/>
>                 <part name="property" element="s0:string"/>
>
> </message>
>
>
>
>
> Or is this required:
>
> <s:element name="string">
>         <s:simpleType>
>                 <s:restriction base="s:string"/>
>         </s:simpleType>
> </s:element>
>
>
> <s:element name="string">
>         <s:simpleType>
>                 <s:restriction base="s:string1"/>
>         </s:simpleType>
> </s:element>
>
>
> <s:element name="string">
>         <s:simpleType>
>                 <s:restriction base="s:string2"/>
>         </s:simpleType>
> </s:element>
>
> .....
>
>
> <message name="getPropertyValueRequest">
>                 <part name="userName" element="s0:string"/>
>                 <part name="property" element="s0:string1"/>
>                 <part name="property" element="s0:string2"/>
>
> </message>
>
>
>
> I'm attaching my wsdl below:
>
>
>
> Regards,
>
> Stefan
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
> xmlns:s0="http://cleartrust.axis.admin/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:s="http://www.w3.org/2001/XMLSchema"
> xmlns:authheader="http://security.astrazeneca.com/admin/authheader"
> targetNamespace="http://cleartrust.axis.admin/">
>         <types>
>                 <s:schema elementFormDefault="qualified"
> targetNamespace="http://cleartrust.axis.admin/">
>                         <s:element name="getGroups">
>                                 <s:complexType>
>                                         <s:sequence/>
>                                 </s:complexType>
>                         </s:element>
>                         <s:element name="stringArray">
>                                 <s:complexType>
>                                         <s:sequence>
>                                                 <s:element minOccurs="0"
> maxOccurs="unbounded" name="item" type="s:string"/>
>                                         </s:sequence>
>                                 </s:complexType>
>                         </s:element>
>                         <s:element name="string">
>                                 <s:simpleType>
>                                         <s:restriction base="s:string"/>
>                                 </s:simpleType>
>                         </s:element>
>                                 <s:element name="string1">
>                                 <s:simpleType>
>                                         <s:restriction base="s:string"/>
>                                 </s:simpleType>
>                         </s:element>
>                         <!-- this WSDL artifact is not WS-I BP1.0compliant,
> but is necessary to enable AXIS to serialize properly -->
>                 </s:schema>
>                 <s:schema elementFormDefault="qualified"
> targetNamespace="http://security.astrazeneca.com/admin/authheader">
>                         <s:element name="AuthenticationHeader">
>                                 <s:complexType>
>                                         <s:sequence>
>                                                 <s:element name="username"
> type="s:string"/>
>                                                 <s:element name="password"
> type="s:string"/>
>                                                 <s:element
> name="admingroup"
> type="s:string"/>
>                                                 <s:element
> name="adminrole"
> type="s:string"/>
>                                         </s:sequence>
>                                 </s:complexType>
>                         </s:element>
>                 </s:schema>
>         </types>
>         <message name="AuthenticationHeader">
>                 <part name="AuthenticationHeader"
> element="authheader:AuthenticationHeader"/>
>         </message>
>         <message name="getGroupsRequest"/>
>         <message name="getGroupsResponse">
>                 <part name="parameters" element="s0:stringArray"/>
>         </message>
>         <message name="getEntitlementsForGroupRequest">
>                 <part name="groupName" element="s0:string"/>
>         </message>
>         <message name="getEntitlementsForGroupResponse">
>                 <part name="parameters" element="s0:stringArray"/>
>         </message>
>         <message name="getEntitlementsForUserRequest">
>                 <part name="userName" element="s0:string"/>
>         </message>
>         <message name="getEntitlementsForUserResponse">
>                 <part name="userName" element="s0:stringArray"/>
>         </message>
>         <message name="getMemberGroupsRequest">
>                 <part name="groupName" element="s0:string"/>
>         </message>
>         <message name="getMemberGroupsResponse">
>                 <part name="parameters" element="s0:stringArray"/>
>         </message>
>         <message name="getPropertiesForUserRequest">
>                 <part name="userName" element="s0:string"/>
>         </message>
>         <message name="getPropertiesForUserResponse">
>                 <part name="parameters" element="s0:stringArray"/>
>         </message>
>         <message name="getPropertyValueRequest">
>                 <part name="userName" element="s0:string"/>
>                 <part name="property" element="s0:string1"/>
>         </message>
>         <message name="getPropertyValueResponse">
>                 <part name="parameters" element="s0:stringArray"/>
>         </message>
>         <portType name="axisWebServiceAdmin">
>                 <operation name="getGroups">
>                         <documentation>Method that returns all the groups
> in
> the active directory.</documentation>
>                         <input message="s0:getGroupsRequest"/>
>                         <output message="s0:getGroupsResponse"/>
>                 </operation>
>                 <operation name="getEntitlementsForGroup">
>                         <documentation>Method that returns all the
> entitlements for a group.</documentation>
>                         <input
> message="s0:getEntitlementsForGroupRequest"/>
>                         <output
> message="s0:getEntitlementsForGroupResponse"/>
>                 </operation>
>                 <operation name="getEntitlementsForUser">
>                         <documentation>Method that returns all the
> entitlements for a user.</documentation>
>                         <input
> message="s0:getEntitlementsForUserRequest"/>
>                         <output
> message="s0:getEntitlementsForUserResponse"/>
>                 </operation>
>                 <operation name="getMemberGroups">
>                         <documentation>Method that returns all the
> entitlements for a user.</documentation>
>                         <input message="s0:getMemberGroupsRequest"/>
>                         <output message="s0:getMemberGroupsResponse"/>
>                 </operation>
>                 <operation name="getPropertiesForUser">
>                         <documentation>Method that returns a users
> properties as defined in ClearTrust.</documentation>
>                         <input message="s0:getPropertiesForUserRequest"/>
>                         <output
> message="s0:getPropertiesForUserResponse"/>
>                 </operation>
>                 <operation name="getPropertyValue">
>                         <documentation>Method that returns the value for
> requsted property.</documentation>
>                         <input message="s0:getPropertyValueRequest"/>
>                         <output message="s0:getPropertyValueResponse"/>
>                 </operation>
>         </portType>
>         <binding name="axisWebServiceAdmin" type="s0:axisWebServiceAdmin">
>                 <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>                 <operation name="getGroups">
>                         <soap:operation
> soapAction="http://cleartrust.axis.admin/getGroups" style="document"/>
>                         <input>
>                                 <soap:body use="literal"/>
>                                 <soap:header
> message="s0:AuthenticationHeader" part="AuthenticationHeader"
> use="literal"/>
>                         </input>
>                         <output>
>                                 <soap:body use="literal"/>
>                         </output>
>                 </operation>
>                 <operation name="getEntitlementsForGroup">
>                         <soap:operation
> soapAction="http://cleartrust.axis.admin/getEntitlementsForGroup"
> style="document"/>
>                         <input>
>                                 <soap:body use="literal"/>
>                                 <soap:header
> message="s0:AuthenticationHeader" part="AuthenticationHeader"
> use="literal"/>
>                         </input>
>                         <output>
>                                 <soap:body use="literal"/>
>                         </output>
>                 </operation>
>
>                 <operation name="getEntitlementsForUser">
>                         <soap:operation
> soapAction="http://cleartrust.axis.admin/getEntitlementsForUser"
> style="document"/>
>                         <input>
>                                 <soap:body use="literal"/>
>                                 <soap:header
> message="s0:AuthenticationHeader" part="AuthenticationHeader"
> use="literal"/>
>                         </input>
>                         <output>
>                                 <soap:body use="literal"/>
>                         </output>
>                 </operation>
>                 <operation name="getMemberGroups">
>                         <soap:operation
> soapAction="http://cleartrust.axis.admin/getMemberGroups"
> style="document"/>
>                         <input>
>                                 <soap:body use="literal"/>
>                                 <soap:header
> message="s0:AuthenticationHeader" part="AuthenticationHeader"
> use="literal"/>
>                         </input>
>                         <output>
>                                 <soap:body use="literal"/>
>                         </output>
>                 </operation>
>                 <operation name="getPropertiesForUser">
>                         <soap:operation
> soapAction="http://cleartrust.axis.admin/getPropertiesForUser"
> style="document"/>
>                         <input>
>                                 <soap:body use="literal"/>
>                                 <soap:header
> message="s0:AuthenticationHeader" part="AuthenticationHeader"
> use="literal"/>
>                         </input>
>                         <output>
>                                 <soap:body use="literal"/>
>                         </output>
>                 </operation>
>                 <operation name="getPropertyValue">
>                         <soap:operation
> soapAction="http://cleartrust.axis.admin/getPropertyValue"
> style="document"/>
>                         <input>
>                                 <soap:body use="literal"/>
>                                 <soap:header
> message="s0:AuthenticationHeader" part="AuthenticationHeader"
> use="literal"/>
>                         </input>
>                         <output>
>                                 <soap:body use="literal"/>
>                         </output>
>                 </operation>
>         </binding>
>         <service name="axisWebServiceAdmin">
>                 <!-- port name becomes the name used in the URL on the
> AXIS/server side. -->
>                 <port name="axisWebServiceAdmin"
> binding="s0:axisWebServiceAdmin">
>                         <soap:address
> location="
> http://seso-odx224225.emea.astrazeneca.net:8080/axis/services/axis
> WebServiceAdmin"/>
>                 </port>
>         </service>
> </definitions>
>
>
>