wsimport, как создать клиент веб-службы из WSDL для http: привязка GET / POST - PullRequest
4 голосов
/ 06 апреля 2010

У меня есть wsdl, и я создаю классы с помощью инструмента wsimport. Все идет нормально для сообщений SOAP, но для http: привязка GET / POST я получаю ошибку. Часть WSDL следует:

<wsdl:binding name="DictServiceHttpPost" type="tns:DictServiceHttpPost"> 
    <http:binding verb="POST" /> 
...
...
...
<wsdl:port name="DictServiceHttpGet" binding="tns:DictServiceHttpGet"> 
      <http:address location="http://services.aonaware.com/DictService/DictService.asmx" /> 
    </wsdl:port> 
    <wsdl:port name="DictServiceHttpPost" binding="tns:DictServiceHttpPost"> 
      <http:address location="http://services.aonaware.com/DictService/DictService.asmx" /> 
</wsdl:port>

wsimport генерирует классы, для порта SOAP он работает, но для GET / POST, но когда я их использую, я получаю сообщение об ошибке.

Caused by: com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: SEI invoker.DictServiceHttpPost has method match annotated as BARE but it has more than one parameter bound to body. This is invalid. Please annotate the method with annotation: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
    at com.sun.xml.internal.ws.model.RuntimeModeler.validateDocBare(RuntimeModeler.java:1247)
    at com.sun.xml.internal.ws.model.RuntimeModeler.processDocBareMethod(RuntimeModeler.java:1236)
    at com.sun.xml.internal.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:609)
    at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:401)
    at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:240)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:687)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:675)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:313)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:295)
    at javax.xml.ws.Service.getPort(Service.java:92)
    at invoker.DictService.getDictServiceHttpPost(DictService.java:124)
    ... 29 more
com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: SEI invoker.DictServiceHttpPost has method match annotated as BARE but it has more than one parameter bound to body. This is invalid. Please annotate the method with annotation: @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)

1 Ответ

0 голосов
/ 19 апреля 2018

Это случилось со мной, проблема была в том, что у меня был публичный метод в реализации сервиса, который имел более одного параметра, но этот метод не был операцией сервиса. Службы, отмеченные: SOAPBinding.ParameterStyle.BARE, должны иметь только открытые методы только с одним параметром. Мое решение было пометить этот метод как закрытый, так как я использовал его из одного открытого метода службы (операции).

Убедитесь, что в реализации службы нет общедоступного метода с более чем одним параметром.

...