Web Services no NetBeans

3 respostas
V

Pessoal,

Não sei se é a maneira certa de trabalhar com Web Services no NetBeans, mas fiz assim:

No meu projeto eu criei um Serviço Web do WSDL, pois já tinha o arquivo WSDL e ele me gerou a seguinte método:

public String verifyClient(String verifyClientRequest) {
        return null;
}

Fiz o teste acessando o endereço: http://localhost:6666/business/IntegrationService

E imprimiu o seguinte:
Port Name Status Information
IntegrationService ACTIVE
Address: http://localhost:6666/business/IntegrationService
WSDL: http://localhost:6666/business/IntegrationService?wsdl
Port QName: {http://www.teste.com.br/dmd/integration/wsdl/}IntegrationService
Implementation class: br.com.teste.www.dmd.integration.wsdl.Integration

Agora quando tento acessar do cliente em php:

Dá os seguintes erros:

08/01/2007 08:49:05 com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher to

MessageInfo

SEVERE: Error in decoding SOAP Message

Error in decoding SOAP Message

at com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.toInternalMessage(

SOAPXMLDecoder.java:89)

at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.toMessageIn

fo(SOAPMessageDispatcher.java:187)

at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker

.invoke(SOAPMessageDispatcher.java:571)

at com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOA

PMessageDispatcher.java:141)

at com.sun.xml.ws.server.Tie.handle(Tie.java:88)

at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.handle(WSServ

letDelegate.java:333)

at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServ

letDelegate.java:288)

at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java

:77)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl

icationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF

ilterChain.java:173)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV

alve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV

alve.java:178)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica

torBase.java:432)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j

ava:126)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j

ava:105)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal

ve.java:107)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav

a:148)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java

:869)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p

rocessConnection(Http11BaseProtocol.java:664)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo

int.java:527)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol

lowerWorkerThread.java:80)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP

ool.java:684)

at java.lang.Thread.run(Thread.java:595)

Caused by: javax.xml.ws.soap.SOAPFaultException: Cannot find the dispatch method
at com.sun.xml.ws.encoding.soap.SOAPDecoder.raiseFault(SOAPDecoder.java:
  1. at com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.decodeDispatchMeth
    od(SOAPXMLDecoder.java:152)
    at com.sun.xml.ws.encoding.soap.SOAPDecoder.decodeBodyContent(SOAPDecode
    r.java:337)
    at com.sun.xml.ws.encoding.soap.SOAPDecoder.decodeBody(SOAPDecoder.java:
  2. at com.sun.xml.ws.encoding.soap.SOAPDecoder.decodeEnvelope(SOAPDecoder.j
    ava:250)
    at com.sun.xml.ws.encoding.soap.server.SOAPXMLDecoder.toInternalMessage(
    SOAPXMLDecoder.java:81)
    … 24 more

Alguém pode me ajudar?

Vinicius.

3 Respostas

T

Só por curiosidade, já experimentou retornar algo que não fosse “null”? Uma string fixa, como “hello”.

V

Deixei assim agora:

public String verifyClient(String verifyClientRequest) {

return null;

}

E deu o mesmo erro, no browser aparece isso:

Array ( [faultcode] => soapenv:Client [faultstring] => Cannot find the dispatch method )

Está em php:

<?php require_once('nusoap.php'); $client = new soapclient('http://localhost:6666/business/IntegrationService'); $teste = 'oi'; $result = $client->call('verifyClient', $teste); print_r($result); ?>

Mais alguma idéia?

V

Encontrei um forum que um cara teve o mesmo problema:

1 - the error “cannot find dispatch method” can happen if there is a mismatch in the targetNameSpace. Can u check if the WebService’s targetNameSpace matches targetnamespace in WSDL?

2 - Thanks very much for your help.
I specified the targetNamespace attribute of the @WebService annotation in the web service LoanProcessor class to conform to the targetNamespace in the WSDL as follows:
@WebService(targetNamespace=“http://loanprocessor.telstra.com/”)

and the application now works fine.

Mas não entendi direito o problema, vc entendeu?

Vinicius.

Criado 8 de janeiro de 2007
Ultima resposta 8 de jan. de 2007
Respostas 3
Participantes 2