mcampelo 2 de mar. de 2004
Você disse que leu o tutorial do axis agui no guj, onde está, não encontrei. Estou precisando invocar webservices feitos em delphi, vc sabe se é possível?
http://www.guj.com.br/servlet/guj?PARSE=true&MAMUTE_ACTION=br.com.guj.action.ListArticle&MAMUTE_TEMPLATE=ShowArticle&LIST_ARTICLE=single&ArticleId=32&PAGE=1
Acredito ser possível invocar WebServices feitos em qualquer linguagem, afinal, não é essa uma das vantagens do dito cujo?
mcampelo 2 de mar. de 2004
Pessoal,
descobri que meu problema estava na ordem do ClassPath. O Log4J estava sendo importado do pacote errado e por isso estava gerando aquela exception.
Infelizmente estou recebendo uma outra mensagem de erro quando rodo o meu Client:
Exception & # 58 ; No such operation ' testeWebService '
AxisFault
faultCode & # 58 ; Server . userException
faultSubcode & # 58 ;
faultString & # 58 ; No such operation & amp ; apos ; testeWebService & amp ; apos ;
faultActor & # 58 ;
faultNode & # 58 ;
faultDetail & # 58 ;
& # 123 ; http & # 58 ; //xml.apache.org/axis/}stackTrace: AxisFault
faultCode & # 58 ; Server . userException
faultSubcode & # 58 ;
faultString & # 58 ; No such operation & amp ; amp ; apos ; testeWebService & amp ; amp ; apos ;
faultActor & # 58 ;
faultNode & # 58 ;
faultDetail & # 58 ;
No such operation ' testeWebService '
at org . apache . axis . message . SOAPFaultBuilder . createFault & # 40 ; SOAPFaultBuilder . java & # 58 ; 260 & # 41 ;
at org . apache . axis . message . SOAPFaultBuilder . endElement & # 40 ; SOAPFaultBuilder . java & # 58 ; 169 & # 41 ;
at org . apache . axis . encoding . DeserializationContextImpl . endElement & # 40 ; DeserializationContextImpl . java & # 58 ; 1015 & # 41 ;
at weblogic . apache . xerces . parsers . AbstractSAXParser . endElement & # 40 ; AbstractSAXParser . java & # 58 ; 585 & # 41 ;
at weblogic . apache . xerces . impl . XMLNamespaceBinder . handleEndElement & # 40 ; XMLNamespaceBinder . java & # 58 ; 898 & # 41 ;
at weblogic . apache . xerces . impl . XMLNamespaceBinder . endElement & # 40 ; XMLNamespaceBinder . java & # 58 ; 644 & # 41 ;
at weblogic . apache . xerces . impl . XMLDocumentFragmentScannerImpl . scanEndElement & # 40 ; XMLDocumentFragmentScannerImpl . java & # 58 ; 1008 & # 41 ;
at weblogic . apache . xerces . impl . XMLDocumentFragmentScannerImpl $ FragmentContentDispatcher . dispatch & # 40 ; XMLDocumentFragmentScannerImpl . java & # 58 ; 1469 & # 41 ;
at weblogic . apache . xerces . impl . XMLDocumentFragmentScannerImpl . scanDocument & # 40 ; XMLDocumentFragmentScannerImpl . java & # 58 ; 329 & # 41 ;
at weblogic . apache . xerces . parsers . DTDConfiguration . parse & # 40 ; DTDConfiguration . java & # 58 ; 525 & # 41 ;
at weblogic . apache . xerces . parsers . DTDConfiguration . parse & # 40 ; DTDConfiguration . java & # 58 ; 581 & # 41 ;
at weblogic . apache . xerces . parsers . XMLParser . parse & # 40 ; XMLParser . java & # 58 ; 152 & # 41 ;
at weblogic . apache . xerces . parsers . AbstractSAXParser . parse & # 40 ; AbstractSAXParser . java & # 58 ; 1175 & # 41 ;
at weblogic . xml . jaxp . WebLogicXMLReader . parse & # 40 ; WebLogicXMLReader . java & # 58 ; 135 & # 41 ;
at weblogic . xml . jaxp . RegistryXMLReader . parse & # 40 ; RegistryXMLReader . java & # 58 ; 138 & # 41 ;
at javax . xml . parsers . SAXParser . parse & # 40 ; SAXParser . java & # 58 ; 345 & # 41 ;
at org . apache . axis . encoding . DeserializationContextImpl . parse & # 40 ; DeserializationContextImpl . java & # 58 ; 242 & # 41 ;
at org . apache . axis . SOAPPart . getAsSOAPEnvelope & # 40 ; SOAPPart . java & # 58 ; 538 & # 41 ;
at org . apache . axis . Message . getSOAPEnvelope & # 40 ; Message . java & # 58 ; 376 & # 41 ;
at org . apache . axis . client . Call . invokeEngine & # 40 ; Call . java & # 58 ; 2583 & # 41 ;
at org . apache . axis . client . Call . invoke & # 40 ; Call . java & # 58 ; 2553 & # 41 ;
at org . apache . axis . client . Call . invoke & # 40 ; Call . java & # 58 ; 2248 & # 41 ;
at org . apache . axis . client . Call . invoke & # 40 ; Call . java & # 58 ; 2171 & # 41 ;
at org . apache . axis . client . Call . invoke & # 40 ; Call . java & # 58 ; 1691 & # 41 ;
at ClientWS . main & # 40 ; ClientWS . java & # 58 ; 14 & # 41 ;
No such operation ' testeWebService '
at org . apache . axis . message . SOAPFaultBuilder . createFault & # 40 ; SOAPFaultBuilder . java & # 58 ; 260 & # 41 ;
at org . apache . axis . message . SOAPFaultBuilder . endElement & # 40 ; SOAPFaultBuilder . java & # 58 ; 169 & # 41 ;
at org . apache . axis . encoding . DeserializationContextImpl . endElement & # 40 ; DeserializationContextImpl . java & # 58 ; 1015 & # 41 ;
at weblogic . apache . xerces . parsers . AbstractSAXParser . endElement & # 40 ; AbstractSAXParser . java & # 58 ; 585 & # 41 ;
at weblogic . apache . xerces . impl . XMLNamespaceBinder . handleEndElement & # 40 ; XMLNamespaceBinder . java & # 58 ; 898 & # 41 ;
at weblogic . apache . xerces . impl . XMLNamespaceBinder . endElement & # 40 ; XMLNamespaceBinder . java & # 58 ; 644 & # 41 ;
at weblogic . apache . xerces . impl . XMLDocumentFragmentScannerImpl . scanEndElement & # 40 ; XMLDocumentFragmentScannerImpl . java & # 58 ; 1008 & # 41 ;
at weblogic . apache . xerces . impl . XMLDocumentFragmentScannerImpl $ FragmentContentDispatcher . dispatch & # 40 ; XMLDocumentFragmentScannerImpl . java & # 58 ; 1469 & # 41 ;
at weblogic . apache . xerces . impl . XMLDocumentFragmentScannerImpl . scanDocument & # 40 ; XMLDocumentFragmentScannerImpl . java & # 58 ; 329 & # 41 ;
at weblogic . apache . xerces . parsers . DTDConfiguration . parse & # 40 ; DTDConfiguration . java & # 58 ; 525 & # 41 ;
at weblogic . apache . xerces . parsers . DTDConfiguration . parse & # 40 ; DTDConfiguration . java & # 58 ; 581 & # 41 ;
at weblogic . apache . xerces . parsers . XMLParser . parse & # 40 ; XMLParser . java & # 58 ; 152 & # 41 ;
at weblogic . apache . xerces . parsers . AbstractSAXParser . parse & # 40 ; AbstractSAXParser . java & # 58 ; 1175 & # 41 ;
at weblogic . xml . jaxp . WebLogicXMLReader . parse & # 40 ; WebLogicXMLReader . java & # 58 ; 135 & # 41 ;
at weblogic . xml . jaxp . RegistryXMLReader . parse & # 40 ; RegistryXMLReader . java & # 58 ; 138 & # 41 ;
at javax . xml . parsers . SAXParser . parse & # 40 ; SAXParser . java & # 58 ; 345 & # 41 ;
at org . apache . axis . encoding . DeserializationContextImpl . parse & # 40 ; DeserializationContextImpl . java & # 58 ; 242 & # 41 ;
at org . apache . axis . SOAPPart . getAsSOAPEnvelope & # 40 ; SOAPPart . java & # 58 ; 538 & # 41 ;
at org . apache . axis . Message . getSOAPEnvelope & # 40 ; Message . java & # 58 ; 376 & # 41 ;
at org . apache . axis . client . Call . invokeEngine & # 40 ; Call . java & # 58 ; 2583 & # 41 ;
at org . apache . axis . client . Call . invoke & # 40 ; Call . java & # 58 ; 2553 & # 41 ;
at org . apache . axis . client . Call . invoke & # 40 ; Call . java & # 58 ; 2248 & # 41 ;
at org . apache . axis . client . Call . invoke & # 40 ; Call . java & # 58 ; 2171 & # 41 ;
at org . apache . axis . client . Call . invoke & # 40 ; Call . java & # 58 ; 1691 & # 41 ;
at ClientWS . main & # 40 ; ClientWS . java & # 58 ; 14 & # 41 ;
A assinatura do WebService está correta:
public String testeWebService();
E se eu chamo a URL http://localhost:8080/axis/EASports.jws?wsdl, recebo a seguinte resposta:
& lt ;? xml version = & quot ; 1.0 & quot ; encoding = & quot ; UTF - 8 & quot ; ? & gt ;
- & lt ; wsdl & # 58 ; definitions targetNamespace = & quot ; http & # 58 ; //localhost:8080/axis/EASports.jws" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/EASports.jws" xmlns:intf="http://localhost:8080/axis/EASports.jws" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- & lt ; wsdl & # 58 ; message name = & quot ; testeWebServiceResponse & quot ; & gt ;
& lt ; wsdl & # 58 ; part name = & quot ; testeWebServiceReturn & quot ; type = & quot ; xsd & # 58 ; string & quot ; /& gt ;
& lt ; / wsdl & # 58 ; message & gt ;
& lt ; wsdl & # 58 ; message name = & quot ; testeWebServiceRequest & quot ; /& gt ;
- & lt ; wsdl & # 58 ; portType name = & quot ; EASports & quot ; & gt ;
- & lt ; wsdl & # 58 ; operation name = & quot ; testeWebService & quot ; & gt ;
& lt ; wsdl & # 58 ; input message = & quot ; impl & # 58 ; testeWebServiceRequest & quot ; name = & quot ; testeWebServiceRequest & quot ; /& gt ;
& lt ; wsdl & # 58 ; output message = & quot ; impl & # 58 ; testeWebServiceResponse & quot ; name = & quot ; testeWebServiceResponse & quot ; /& gt ;
& lt ; / wsdl & # 58 ; operation & gt ;
& lt ; / wsdl & # 58 ; portType & gt ;
- & lt ; wsdl & # 58 ; binding name = & quot ; EASportsSoapBinding & quot ; type = & quot ; impl & # 58 ; EASports & quot ; & gt ;
& lt ; wsdlsoap & # 58 ; binding style = & quot ; rpc & quot ; transport = & quot ; http & # 58 ; //schemas.xmlsoap.org/soap/http" />
- & lt ; wsdl & # 58 ; operation name = & quot ; testeWebService & quot ; & gt ;
& lt ; wsdlsoap & # 58 ; operation soapAction = & quot ; & quot ; /& gt ;
- & lt ; wsdl & # 58 ; input name = & quot ; testeWebServiceRequest & quot ; & gt ;
& lt ; wsdlsoap & # 58 ; body encodingStyle = & quot ; http & # 58 ; //schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded" />
& lt ; / wsdl & # 58 ; input & gt ;
- & lt ; wsdl & # 58 ; output name = & quot ; testeWebServiceResponse & quot ; & gt ;
& lt ; wsdlsoap & # 58 ; body encodingStyle = & quot ; http & # 58 ; //schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/EASports.jws" use="encoded" />
& lt ; / wsdl & # 58 ; output & gt ;
& lt ; / wsdl & # 58 ; operation & gt ;
& lt ; / wsdl & # 58 ; binding & gt ;
- & lt ; wsdl & # 58 ; service name = & quot ; EASportsService & quot ; & gt ;
- & lt ; wsdl & # 58 ; port binding = & quot ; impl & # 58 ; EASportsSoapBinding & quot ; name = & quot ; EASports & quot ; & gt ;
& lt ; wsdlsoap & # 58 ; address location = & quot ; http & # 58 ; //localhost:8080/axis/EASports.jws" />
& lt ; / wsdl & # 58 ; port & gt ;
& lt ; / wsdl & # 58 ; service & gt ;
& lt ; / wsdl & # 58 ; definitions & gt ;
O que estou fazendo de errado?
Obrigado,
mcampelo 3 de mar. de 2004
Provavelmente está faltando os imports:
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
mcampelo 3 de mar. de 2004
“wender”:
Exatamente…coloquei-os e funcionou !!! Valeu
E vc conseguiu resolver seu problema?
Infelizmente meu client ainda não está funcionando.
Você conseguiu rodar o exemplo completo? Seu client funcionou?
Entrei para a lista de usuários do Axis, postei uma mensagem lá, mas até agora fui ignorado solenemente, ou como gosta de dizer um amigo meu: defecaram no meu crânio!
mcampelo 3 de mar. de 2004
Então fiz alguma bobagem no meu Client, vou tentar de novo com um exemplo igual ao do artigo!
Quanto ao Google, você tem o número de licença para fazer a chamada ao WebService?
mcampelo 4 de mar. de 2004
“wender”:
consegui chamar o exemplo do Fibonacci mas o do Google não
Então fiz alguma bobagem no meu Client, vou tentar de novo com um exemplo igual ao do artigo!
Realmente havia um erro no Client:
String ret = & # 40 ; String & # 41 ; call . invoke & # 40 ; new Object & # 91 ; & # 93 ; & # 123 ; new String & # 40 ; & # 41 ; & # 125 ; & # 41 ;;
Enquanto que a assinatura do meu WebService era:
Bastou alterar a assinatura do meu WebService e tudo funcionou: