public class SOAPCorreiosClient {
public static void main(String[] args) {
SoapClient client = new SoapClient(
"https://apps.correios.com.br/SigepMasterJPA/AtendeClienteService/AtendeCliente"
).debug(true);
try {
//Complexidade para montar a mensagem soap
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapRequest = messageFactory.createMessage();
SOAPPart soapPart = soapRequest.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("cli", "http://cliente.bean.master.sigep.bsb.correios.com.br/");
SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement("consultaCEP", "cli");
soapBodyElem.addChildElement("cep").addTextNode("73368470");
SOAPMessage response = client.request(soapRequest).send().response();
}catch (Exception exc) {
exc.printStackTrace();
}
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Client SOAP em JAVA.
License
delmobispo/soap-client-wrapper
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Client SOAP em JAVA.
Topics
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published