Consume wsdl webservice in java

Asked

Viewed 2,879 times

3

I need to consume a wsdl webservice but I do not know how to load a method and pass the parameters inside that webservice to return me the desired value.

This is the webservice:

This XML file does not appear to have any style information Associated with it. The Document Tree is Shown Below.

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" name="IadWSMediaParcialservice" targetNamespace="http://tempuri.org/">
<message name="CalcularMediaParcial0Request">
<part name="dirConfigIni" type="xs:string"/>
<part name="GUID" type="xs:string"/>
<part name="idEmpresa" type="xs:int"/>
<part name="idGrupoEmpresa" type="xs:int"/>
<part name="idUsuario" type="xs:int"/>
<part name="idPeriodoLetivo" type="xs:int"/>
<part name="idCurso" type="xs:int"/>
<part name="idCiclo" type="xs:int"/>
<part name="idSerie" type="xs:int"/>
<part name="idFaseCalendario" type="xs:int"/>
<part name="idProfessor" type="xs:int"/>
<part name="idDisciplina" type="xs:int"/>
<part name="idTurma" type="xs:int"/>
</message>
<message name="CalcularMediaParcial0Response">
<part name="return" type="xs:string"/>
</message>
<portType name="IadWSMediaParcial">
<operation name="CalcularMediaParcial">
<input message="tns:CalcularMediaParcial0Request"/>
<output message="tns:CalcularMediaParcial0Response"/>
</operation>
</portType>
<binding name="IadWSMediaParcialbinding" type="tns:IadWSMediaParcial">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="CalcularMediaParcial">
<soap:operation soapAction="urn:adWSMediaParcialIntf-IadWSMediaParcial#CalcularMediaParcial" style="rpc"/>
<input message="tns:CalcularMediaParcial0Request">
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:adWSMediaParcialIntf-IadWSMediaParcial"/>
</input>
<output message="tns:CalcularMediaParcial0Response">
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:adWSMediaParcialIntf-IadWSMediaParcial"/>
</output>
</operation>
</binding>
<service name="IadWSMediaParcialservice">
<port name="IadWSMediaParcialPort" binding="tns:IadWSMediaParcialbinding">
<soap:address location="http://adv-des-12/adWSMediaParcial.dll/soap/IadWSMediaParcial"/>
</port>
</service>
</definitions>

I created the following interface:

public interface DLL {

    public String CalcularMediaParcial(String caminho,
            String GUID, int idEmpresa, int idGrupoEmpresa, int idUsuario, int idPeriodoLetivo,
            int idCurso, int idCiclo, int idSerie, int idFaseCalendario, int idProfessor, int idDisciplina,
            int idTurma);

    public void LiberarRecursos();
}

How do I load webservice and call this method Calculator?

1 answer

0

You can use the command:

wsimport -d [caminho_destino_do_source] [arquivo_wsdl]

In this destination, classes will be generated, just import into your IDE.

  • This command is linux?

  • this utility comes bundled with jdk at least on Openjdk 8.

  • Blz, with the generated classes we were able to consume the wsdl ?

  • will create a handful of classes and together will create an interface of the same style as the one you created link

Browser other questions tagged

You are not signed in. Login or sign up in order to post.