Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>For JAX-WS webservices it may be a problem with the hashmap input parameter. The xsd schema generated seems to be incorrect for hashmaps. Placing the map in a wrapper object causes JAX-WS to output the correct xsd.</p> <pre><code>public class MapWrapper { public HashMap&lt;String, String&gt; map; } // in your web service class @WebMethod(operationName = "doSomething") public SomeResponseObject doSomething( @WebParam(name = "id") String id, @WebParam(name = "page") String page, @WebParam(name = "params") MapWrapper params { // body of method } </code></pre> <p>Then the php code will succeed. I found I didn't need SoapVar or SoapParam and could not get either of those methods to work without the MapWrapper.</p> <pre><code>$entry1['key'] = 'somekey'; $entry1['value'] = 1; $params['map'] = array($entry1); soapclient-&gt;doSomething(array('id' =&gt; 'blah', 'page' =&gt; 'blah', 'params' =&gt; $params)); </code></pre> <p>Here is the correct xsd generated with the wrapper</p> <pre><code>&lt;xs:complexType name="mapWrapper"&gt; &lt;xs:sequence&gt; &lt;xs:element name="map"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="entry" minOccurs="0" maxOccurs="unbounded"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="key" minOccurs="0" type="xs:string"/&gt; &lt;xs:element name="value" minOccurs="0" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; </code></pre> <p>Here is the incorrect schema generated by JAX-WS with just the hashmap</p> <pre><code>&lt;xs:complexType name="hashMap"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="tns:abstractMap"&gt; &lt;xs:sequence/&gt; &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="abstractMap" abstract="true"&gt; &lt;xs:sequence/&gt; &lt;/xs:complexType&gt; </code></pre> <p>One last note. Wrapping HashMap&lt;String, String&gt; worked with this solution, but HashMap&lt;String, Object&gt; did not. The Object gets mapped to xsd:anyType which comes into the java webservice as a xsd schema object rather than just Object.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload