Description of string array in wsdl file

I use the globus toolkit for the project. In my service, I have a resource: a string array. I want to get this resource from an Android client. How can i do this? How can I describe a string array type in a wsdl file? Thanks.

+4
source share
3 answers

I think you are looking for it.

<complexType name='ArrayOfString'> <sequence> <element name='item' type='xsd:string' maxOccurs='unbounded'/> </sequence> </complexType> 

Source: http://www.activebpel.org/samples/samples-2/BPEL_Samples/Resources/Docs/arrays.html

UPDATE:

I conducted a test using NetBeans 7.0.1. The result of this was the following:

Declare a method that receives the String [] parameter:

 @WebMethod(operationName = "helloArray") public String helloArray(@WebParam(name = "name") String[] name) { StringBuilder sb = new StringBuilder("Hello "); if (name != null) { for(int i = 0; i < name.length; i++) { sb.append(name[i]); if (i < (name.length - 1)) { sb.append(" and "); } } } sb.append('!'); return sb.toString(); } 

WSDL generated a complex type for my method with an array element String

 <xs:complexType name="helloArray"> <xs:sequence> <xs:element name="name" type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> 

In the client, the IDE generated a List<String> to use it:

 @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "helloArray", propOrder = {"name"}) public class HelloArray { @XmlElement(nillable = true) protected List<String> name; public List<String> getName() { if (name == null) { name = new ArrayList<String>(); } return this.name; } } 

And the method of using the service

 private String helloArray(java.util.List<java.lang.String> name) { edu.home.wsclient.HelloWorldWS port = service.getHelloWorldWSPort(); return port.helloArray(name); } 

I downloaded both projects at this address

+3
source

You can use a custom type that has a String element (and more data if you want) with a multiplicity> 1.

 <xsd:sequence> <xsd:element name="YourClass" type="pre:YourClass" maxOccurs="unbounded" minOccurs="0"> </xsd:element> </xsd:sequence> 
+1
source

Ask XML to call the parent tag with several children, each of which has one string value from your array:

 <parent> <child>String 1</child> <child>String 2</child> </parent> 

Name the tags accordingly.

0
source

Source: https://habr.com/ru/post/1411121/


All Articles