JAX-WS 웹 서비스의 경우 hashmap 입력 매개 변수에 문제가있을 수 있습니다. 생성 된 xsd 스키마가 해시 맵에 대해 올바르지 않은 것 같습니다. 맵을 랩퍼 오브젝트에두면 JAX-WS가 올 Y 른 xsd를 출력합니다.
public class MapWrapper {
public HashMap<String, String> 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
}
그러면 PHP 코드가 성공합니다. SoapVar 또는 SoapParam이 필요하지 않으며 MapWrapper없이 작동 할 수있는 메서드 중 하나를 얻을 수 없다는 것을 알았습니다.
$entry1['key'] = 'somekey';
$entry1['value'] = 1;
$params['map'] = array($entry1);
soapclient->doSomething(array('id' => 'blah', 'page' => 'blah',
'params' => $params));
여기 여기에 단지 해시 맵
<xs:complexType name="hashMap">
<xs:complexContent>
<xs:extension base="tns:abstractMap">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="abstractMap" abstract="true">
<xs:sequence/>
</xs:complexType>
마지막 메모와 함께 JAX-WS에 의해 생성 된 잘못된 스키마는 래퍼
<xs:complexType name="mapWrapper">
<xs:sequence>
<xs:element name="map">
<xs:complexType>
<xs:sequence>
<xs:element name="entry" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="key" minOccurs="0" type="xs:string"/>
<xs:element name="value" minOccurs="0" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
생성 올바른 XSD입니다. 줄 바꿈 HashMap < 문자열, 문자열 >이 솔루션과 함께 작동하지만 HashMap < 문자열, 개체 >하지 않았습니다. Object는 xsd : anyType에 매핑되며 Java WebService에는 Object가 아닌 xsd 스키마 객체로 제공됩니다.