WebServicesServiceLocator não encontrado

Olá pessoal,

mais uma vez vou pedir a ajuda de vcs…pois estou testando uns programas referente WEBSERVICE …e está me dando erro na linha :

EDIServicesService svc = new WebServicesServiceLocator();

erro :

WebServicesServiceLocator() cannot resolved be resolved to a typee
EDIServicesService cannot resolved be resolved to a typee

Alguém poderia me dar uma ajuda …

abs

package webservice;

import java.io.File;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;


public class EDICliente{
	
     public boolean enviarArquivo(File file){
           try{
        	   
                EDIServicesService svc = new WebServicesServiceLocator();
                EDIServices s = svc.getEDIService ();

                // Preparando o arquivo pra ser enviado
                DataHandler dh = new DataHandler(new FileDataSource(file));

                return s.receberArquivo(dh, file.getName());
           }catch(Exception ex){
                 ex.printStackTrace();
                 return false;
           }
    }
}     

Você gerou as classes do cliente do Web services? Elas estão no mesmo pacote?

Olá ,

sou novato em java e estou fazendo um exemplo de WEBSERVICE e não estou conseguindo gerar umas classes o que estou fazendo via msdos :


C:\temps\guj\webservice>ant build
Buildfile: build.xml

BUILD FAILED
Error reading project file C:\temps\guj\webservice\build.xml: Invalid byte 2 of
3-byte UTF-8 sequence.

Total time: 0 seconds
C:\temps\guj\webservice>



import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import javax.activation.DataHandler;

public class EDIServices{
	
  public boolean receberArquivo(DataHandler arquivo, String nome){
     // Verificando se o arquivo é nulo
     if(arquivo == null)
        return false;

     try {
         // Criando o arquivo de destino
         File novoArquivo = new File("c:/" + nome + ".txt");
         OutputStream out = new FileOutputStream(novoArquivo);

         // Escrevendo os dados do arquivo recebido na saida
         arquivo.writeTo(out);
         return true;
     }catch (Exception ex){
             return false;
     }
   }
}

----
package webservice;

import java.io.File;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;


public class EDICliente{
	
     public boolean enviarArquivo(File file){
           try{
        	   
        	   
                EDIServicesService svc = new WebServicesServiceLocator();
                
                EDIServices s = svc.getEDIService ();

                // Preparando o arquivo pra ser enviado
                DataHandler dh = new DataHandler(new FileDataSource(file));

                return s.receberArquivo(dh, file.getName());
           }catch(Exception ex){
                 ex.printStackTrace();
                 return false;
           }
    }
}     

Leia a apostila de Apache Axis aqui: http://java.danieldestro.com.br

Obrigado pela dica …ótima a documetação …não sei se você já teve esse erro mais estou tentando gerar serviço WSDL e está me dando erro :

Se puder me ajudar agradeceria …

abs


C:\temps\guj\webservice>java -cp org.apache.axis.wsdl.Java2WSDL -o EDIServices.w
sdl -l"http://127.0.0.1:8080/axis/services/EDIServices" -n"urn:EDIServices" -p"w
ebservice.ws" "urn:EDIServices"webservice.EDIServices
Unrecognized option: -o
Could not create the Java virtual machine.

O parâmetro -cp do java pede um valor, que você não está passando.
O -cp indica o CLASSPATH que você está informando, caso ele já não esteja configurado no ambiente.

EU TIREI POIS DEFINI UMA VARIAVEL AXI_HOME E COLOQUEI NO CLASSPATH …

EU TIREI O PARAMETRO -CP E AGORA DEU ERRO :

C:\temps\guj\webservice>java  org.apache.axis.wsdl.Java2WSDL -o EDIServices.wsdl
 -l"http://127.0.0.1:8080/axis/services/EDIServices" -n"urn:EDIServices" -p"webs
ervice.ws" "urn:EDIServices"webservice.EDIServices
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/wsdl/
Java2WSDL

C:\temps\guj\webservice>

Não sei mas o que fazer inclui uma a uma jar que estão diretorio AXIS/lib no classpath e agora está me dando esse erro :


C:\temps\guj\webservice>java org.apache.axis.wsdl.Java2WSDL -o EDIServices.wsdl
-l"http://127.0.0.1:8080/axis/EDIServices" -n"urn:EDIServices" -p"webservice.ws"
 "urn:EDIServices"webservice.EDIServices
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/encodin
g/TypeMappingRegistry
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)

C:\temps\guj\webservice>

Você tá usando Java 5?
Se sim, tem que incluir o Xerces no Classpath.

Olá ,

abaixo está como configurei minha máquina (WINDOWS XP) está faltando algo ???
estou com :

apache-tomcat-5.5.15
jdk1.5.0_06

e as variaveis :


AXIS_HOME=C:\axis-1_4\lib
CATALINA_HOME=C:\apache-tomcat-5.5.15
CLASSPATH=C:\jdk1.5.0_06\bin;%CATALINA_HOME%\common\lib\servlet-api.jar;%AXIS_HOME%;C:\axis-1_4\lib\axis.jar;%CLASSPATH%;
JAVA_HOME=C:\jdk1.5.0_06
Path=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\apache-ant-1.6.5\bin;C:\PDFLIV~1;C:\PDFLIV~1\GS6.01\BIN;C:\PDFLIV~1\GS6.01\LIB;

verifiquei no diretório :

C:\jdk1.5.0_06\lib\xerces.jar

e mesmo assim está dando erro se alguém puder me ajudar agradeceria …:

C:\temps\guj\webservice>java -cp C:\axis-1_4\lib\axis.jar org.apache.axis.wsdl.J
ava2WSDL -o EDIServices.wsdl -l"http://127.0.0.1:8080/axis/EDIServices" -n"urn:E
DIServices" -p"webservice.ws" "urn:EDIServices"webservice.EDIServices
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/encodin
g/TypeMappingRegistry
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)

C:\temps\guj\webservice>

agora como ficou e mesmo assim da erro :

CLASSPATH=
C:\jdk1.5.0_06\bin;%CATALINA_HOME%\common\lib\servlet-api.jar;%AXIS_HOME%;C:\axis-1_4\lib\axis.jar;C:/axis-1_4/lib/wsdl4j-1.5.1.jar;C:/axis-1_4/lib/axis.jar;C:/axis-1_4/lib/axis-ant.jar;C:/axis-1_4/lib/axis-schema.jar;C:/axis-1_4/lib/commons-discovery-0.2.jar;C:/axis-1_4/lib/commons-logging-1.0.4.jar;C:/axis-1_4/lib/jaxrpc.jar;C:/axis-1_4/lib/log4j-1.2.8.jar;C:/axis-1_4/lib/saaj.jar;%CLASSPATH%;

C:\temps\guj\webservice>java org.apache.axis.wsdl.Java2WSDL -o EDIServices.wsdl
-l"http://127.0.0.1:8080/axis/EDIServices" -n"urn:EDIServices" -p"webservice.ws"
"urn:EDIServices"webservice.EDIServices

  • Unable to find required classes (javax.activation.DataHandler and javax.mail.i
    nternet.MimeMultipart). Attachment support is disabled.
    The <class-of-portType> was not specified.
    Java2WSDL emitter
    Usage: java org.apache.axis.wsdl.Java2WSDL [options] class-of-portType
    Options:
    -h, --help
    print this message and exit
    -I, --input <argument>
    input WSDL filename
    -o, --output <argument>
    output WSDL filename
    -l, --location <argument>
    service location url
    -P, --portTypeName <argument>
    portType name (obtained from class-of-portType if not specif
    ied)
    -b, --bindingName <argument>
    binding name (–servicePortName value + “SOAPBinding” if not
    specified)
    -S, --serviceElementName <argument>
    service element name (defaults to --servicePortName value +
    “Service”)
    -s, --servicePortName <argument>
    service port name (obtained from --location if not specified
    )
    -n, --namespace <argument>
    target namespace
    -p, --PkgtoNS <argument>=<value>
    package=namespace, name value pairs
    -m, --methods <argument>
    space or comma separated list of methods to export
    -a, --all
    look for allowed methods in inherited class
    -w, --outputWsdlMode <argument>
    output WSDL mode: All, Interface, Implementation
    -L, --locationImport <argument>
    location of interface wsdl
    -N, --namespaceImpl <argument>
    target namespace for implementation wsdl
    -O, --outputImpl <argument>
    output Implementation WSDL filename, setting this causes --o
    utputWsdlMode to be ignored
    -i, --implClass <argument>
    optional class that contains implementation of methods in cl
    ass-of-portType. The debug information in the class is used
    to obtain the method parameter names, which are used to set
    the WSDL part names.
    -x, --exclude <argument>
    space or comma separated list of methods not to export
    -c, --stopClasses <argument>
    space or comma separated list of class names which will stop
    inheritance search if --all switch is given
    -T, --typeMappingVersion <argument>
    indicate 1.1 or 1.2. The default is 1.1 (SOAP 1.1 JAX-RPC c
    ompliant 1.2 indicates SOAP 1.1 encoded.)
    -A, --soapAction <argument>
    value of the operation’s soapAction field. Values are DEFAUL
    T, OPERATION or NONE. OPERATION forces soapAction to the nam
    e of the operation. DEFAULT causes the soapAction to be set
    according to the operation’s meta data (usually “”). NONE
    forces the soapAction to “”. The default is DEFAULT.
    -y, --style <argument>
    The style of binding in the WSDL, either DOCUMENT, RPC, or W
    RAPPED.
    -u, --use <argument>
    The use of items in the binding, either LITERAL or ENCODED
    -e, --extraClasses <argument>
    A space or comma separated list of class names to be added t
    o the type section.
    -C, --importSchema
    A file or URL to an XML Schema that should be physically imp
    orted into the generated WSDL
    -X, --classpath
    additional classpath elements
    -d, --deploy
    generate wsdd and java classes for deploying
    Details:
    portType element name= <–portTypeName value> OR <class-of-portType name>
    binding element name= <–bindingName value> OR <–servicePortName value>Soap
    Binding
    service element name= <–serviceElementName value> OR <–portTypeName value>
    Service
    port element name= <–servicePortName value>
    address location = <–location value>

C:\temps\guj\webservice>

estou apanhando mas não vou desistir agora está dano esse erro de parametro :

[code]C:\temps\guj\webservice>java org.apache.axis.wsdl.Java2WSDL -o EDIServices.wsdl
-l"http://127.0.0.1:8080/axis/EDIServices" -n"urn:EDIServices" -p"webservice.ws
" "urn:EDIServices"webservice.EDIServices
The was not specified.
Java2WSDL emitter
Usage: java org.apache.axis.wsdl.Java2WSDL [options] class-of-portType
Options:
-h, --help
print this message and exit
-I, --input
input WSDL filename
-o, --output
output WSDL filename
-l, --location
service location url
-P, --portTypeName
portType name (obtained from class-of-portType if not specif
ied)
-b, --bindingName
binding name (–servicePortName value + “SOAPBinding” if not
specified)
-S, --serviceElementName
service element name (defaults to --servicePortName value +
“Service”)
-s, --servicePortName
service port name (obtained from --location if not specified
)
-n, --namespace
target namespace
-p, --PkgtoNS =
package=namespace, name value pairs
-m, --methods
space or comma separated list of methods to export
-a, --all
look for allowed methods in inherited class
-w, --outputWsdlMode
output WSDL mode: All, Interface, Implementation
-L, --locationImport
location of interface wsdl
-N, --namespaceImpl
target namespace for implementation wsdl
-O, --outputImpl
output Implementation WSDL filename, setting this causes --o
utputWsdlMode to be ignored
-i, --implClass
optional class that contains implementation of methods in cl
ass-of-portType. The debug information in the class is used
to obtain the method parameter names, which are used to set
the WSDL part names.
-x, --exclude
space or comma separated list of methods not to export
-c, --stopClasses
space or comma separated list of class names which will stop
inheritance search if --all switch is given
-T, --typeMappingVersion
indicate 1.1 or 1.2. The default is 1.1 (SOAP 1.1 JAX-RPC c
ompliant 1.2 indicates SOAP 1.1 encoded.)
-A, --soapAction
value of the operation’s soapAction field. Values are DEFAUL
T, OPERATION or NONE. OPERATION forces soapAction to the nam
e of the operation. DEFAULT causes the soapAction to be set
according to the operation’s meta data (usually “”). NONE
forces the soapAction to “”. The default is DEFAULT.
-y, --style
The style of binding in the WSDL, either DOCUMENT, RPC, or W
RAPPED.
-u, --use
The use of items in the binding, either LITERAL or ENCODED
-e, --extraClasses
A space or comma separated list of class names to be added t
o the type section.
-C, --importSchema
A file or URL to an XML Schema that should be physically imp
orted into the generated WSDL
-X, --classpath
additional classpath elements
-d, --deploy
generate wsdd and java classes for deploying
Details:
portType element name= <–portTypeName value> OR
binding element name= <–bindingName value> OR <–servicePortName value>Soap
Binding
service element name= <–serviceElementName value> OR <–portTypeName value>
Service
port element name= <–servicePortName value>
address location = <–location value>

C:\temps\guj\webservice>
[/code]

Você está disponilizando a API do JAX-RPC? Acho que se chama jaxrpc.jar.

o que fiz coloquei todos jar do lib AXIS no classpath ai parou de dar erro ,mas agora está dando esse erro abaixo .
Estou gerando o comando abaixo no diretorio onde estão as classes referente ao WEBSERVICE …

Está solicitando The <class-of-portType> was not specified. ??? não entendi ???

Se puder me ajudar !!!



C:\temps\guj\webservice>java org.apache.axis.wsdl.Java2WSDL -oc:\temps\guj\webse
rvice\EDIServices.wsdl -l"http://127.0.0.1:8080/axis/EDIServices" -n"urn:EDIServ
ices" -p"C:\temps\guj\webservice\webservice.ws" "urn:EDIServices"webservice.EDIS
ervices
The <class-of-portType> was not specified.
Java2WSDL emitter
Usage: java org.apache.axis.wsdl.Java2WSDL [options] class-of-portType
Options:
        -h, --help
                print this message and exit
        -I, --input <argument>
                input WSDL filename
        -o, --output <argument>
                output WSDL filename
        -l, --location <argument>
                service location url
        -P, --portTypeName <argument>
                portType name (obtained from class-of-portType if not specif
                ied)
        -b, --bindingName <argument>
                binding name (--servicePortName value + "SOAPBinding" if not
                 specified)
        -S, --serviceElementName <argument>
                service element name (defaults to --servicePortName value +
                "Service")
        -s, --servicePortName <argument>
                service port name (obtained from --location if not specified
                )
        -n, --namespace <argument>
                target namespace
        -p, --PkgtoNS <argument>=<value>
                package=namespace, name value pairs
        -m, --methods <argument>
                space or comma separated list of methods to export
        -a, --all
                look for allowed methods in inherited class
        -w, --outputWsdlMode <argument>
                output WSDL mode: All, Interface, Implementation
        -L, --locationImport <argument>
                location of interface wsdl
        -N, --namespaceImpl <argument>
                target namespace for implementation wsdl
        -O, --outputImpl <argument>
                output Implementation WSDL filename, setting this causes --o
                utputWsdlMode to be ignored
        -i, --implClass <argument>
                optional class that contains implementation of methods in cl
                ass-of-portType.  The debug information in the class is used
                 to obtain the method parameter names, which are used to set
                 the WSDL part names.
        -x, --exclude <argument>
                space or comma separated list of methods not to export
        -c, --stopClasses <argument>
                space or comma separated list of class names which will stop
                 inheritance search if --all switch is given
        -T, --typeMappingVersion <argument>
                indicate 1.1 or 1.2.  The default is 1.1 (SOAP 1.1 JAX-RPC c
                ompliant  1.2 indicates SOAP 1.1 encoded.)
        -A, --soapAction <argument>
                value of the operation's soapAction field. Values are DEFAUL
                T, OPERATION or NONE. OPERATION forces soapAction to the nam
                e of the operation.  DEFAULT causes the soapAction to be set
                 according to the operation's meta data (usually "").  NONE
                forces the soapAction to "".  The default is DEFAULT.
        -y, --style <argument>
                The style of binding in the WSDL, either DOCUMENT, RPC, or W
                RAPPED.
        -u, --use <argument>
                The use of items in the binding, either LITERAL or ENCODED
        -e, --extraClasses <argument>
                A space or comma separated list of class names to be added t
                o the type section.
        -C, --importSchema
                A file or URL to an XML Schema that should be physically imp
                orted into the generated WSDL
        -X, --classpath
                additional classpath elements
        -d, --deploy
                generate wsdd and java classes for deploying
Details:
   portType element name= <--portTypeName value> OR <class-of-portType name>
   binding  element name= <--bindingName value> OR <--servicePortName value>Soap
Binding
   service  element name= <--serviceElementName value> OR <--portTypeName value>
Service
   port     element name= <--servicePortName value>
   address location     = <--location value>


C:\temps\guj\webservice>

Cara, tenta refazer o seu WS, tudo de novo.