I have received these guidelines to access and consume the ListSourceProducts method of a WebService:
Standard form of authentication of the Java application webservices for entities and associates
It is necessary for the client to have an operator registered in the system, with access permission "web-service" and password specific to the access medium; the authentication mechanism uses the HTTP basic authentication pattern.
The login data (operator and password) must be sent in the specific header (Authorization), encrypted in Base 64, example:
The operator name (in the example, "wsteste") and the password (in the example, "wsteste333") must be concatenated: wsteste: wsteste333
Next, they should be encrypted in Base 64: d3N0ZXN0ZTp3c3Rlc3RlMzMz
The requests must be sent containing the header, using the sequence encrypted: Authorization: Basic d3N0ZXN0ZTp3c3Rlc3RlMzMz
The login is executed in every web-service operation; therefore, every request must have the header specified above; if the login does not occur successfully, the service returns "HTTP ERROR: 401";
Sample request containing the header:
Cookie: $Version=0; JSESSIONID=48g39p406ezh_dev01; $Path=/spc
Authorization: Basic d3N0ZXN0ZTp3c3Rlc3RlMzMz
Host: localhost:8080
Content-Length: 1799
SOAPAction: ""
User-Agent: Jakarta Commons-HttpClient/3.0.1
Content-Type: text/xml;charset=UTF-8
Connection: close
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://webservice.consulta.xxxjava.spcbrasil.org/">
<soapenv:Header/>
<soapenv:Body>
...
</soapenv:Body>
</soapenv:Envelope>
I received the Login and Password and I have some knowledge in consuming WebService based on some articles:
ASP. NET 2008 - Creating Web Services II
VB. NET - Consuming Web Services with Windows Forms
The problem is that when adding the reference to the project and the screen prompts for the login and password and after informing Login and Password, I return the messages below and I'm not sure if I'm doing it right, or there is a problem with that login and password provided by the Customer?
ThisisWSDL:
<!--PublishedbyJAX-WSRIathttp://jax-ws.dev.java.net.RI'sversionisJAX-WSRI2.2.1-hudson-28-.--><!--GeneratedbyJAX-WSRIathttp://jax-ws.dev.java.net.RI'sversionisJAX-WSRI2.2.1-hudson-28-.--><definitionsxmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservice.consulta.spcjava.spcbrasil.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://webservice.consulta.spcjava.spcbrasil.org/" name="consultaWebService">
<types>...</types>
<message name="listarProdutos"/>
<message name="listarProdutosResponse">
<part name="produtos" element="tns:produtos"/>
</message>
<message name="consultar">...</message>
<message name="consultarResponse">...</message>
<message name="detalharProduto">...</message>
<message name="detalharProdutoResponse">...</message>
<message name="consultaComplementar">...</message>
<message name="consultaComplementarResponse">...</message>
<message name="consultaScore">...</message>
<message name="consultaScoreResponse">...</message>
<portType name="consultaWebService">...</portType>
<binding name="consultaWebServicePortBinding" type="tns:consultaWebService">...</binding>
<service name="consultaWebService">...</service>
</definitions>
Operation "listProducts"
Description: Returns the products available for consultation. Home
Rules of use:
1. If there are no products available to the operator, the operation does not return given. Home
Input Parameters: not applicable
I've implemented the Rovann Linhalis tip, but maybe I still do something wrong in the implementation because it occurs error: