tips and handy

when I consume in custom java application, following lines are getting print in console... javax.xml.soap.SOAPException: Not a valid SOAP Content-Type: application/xml ===== reqeust ======== Content-Type:text/xml; charset=UTF-8 Content-Length:306 SOAPAction:"http://tempuri.org/IWaselAddressService/GetIndividualWaselAddress" Authorization:Bearer D8uiNeKyepGsXEGlnqMJIcPulquh NationalID1030036857 =================================== and I think these lines are in sop of wsdl, as I didn't set any sop in my code ======= Map> httpHeaderMap = new HashMap>(); public ConfigHeaders() { System.out.println("calling >>> ConfigHeaders"); MainBaladyToken token = new MainBaladyToken(); // Map> headers = new HashMap>(); httpHeaderMap.put("Authorization", Collections.singletonList(token.getTokenKey(1))); httpHeaderMap.put("Host", Collections.singletonList("apiservices.balady.gov.sa")); // headers.put("Content-Type", Collections.singletonList("text/xml; charset=utf-8")); // httpHeaderMap.put("SOAPAction", Collections.singletonList("http://tempuri.org/IWaselAddressService/GetIndividualWaselAddress")); httpHeaderMap.put("Content-Type", Collections.singletonList("text/xml;charset=utf-8")); System.out.println("Authorization-------> " + httpHeaderMap.get("Authorization")); System.out.println("Content-Type-------> " + httpHeaderMap.get("Content-Type")); System.out.println("Host-------> " + httpHeaderMap.get("Host")); } ====== From SOAP UI ============ POST https://apiservices.balady.gov.sa/v1/gsb/wasel-address-service HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: text/xml;charset=UTF-8 SOAPAction: "http://tempuri.org/IWaselAddressService/GetIndividualWaselAddress" Authorization: Bearer xxxxxxxxxx Content-Length: 385 Host: apiservices.balady.gov.sa Connection: Keep-Alive User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1) NationalID xxxxxx Response ======== it's giving proper response From Postman ============ POST /v1/gsb/wasel-address-service HTTP/1.1 Host: apiservices.balady.gov.sa Content-Type: text/xml; charset=utf-8 SOAPAction: http://tempuri.org/IWaselAddressService/GetIndividualWaselAddress Authorization: Bearer xxxxxxxx Content-Length: 341 NationalID xxxxxx Response ======== MOMRA:101 Request had bad syntax or invalid parameters

Comments

Popular posts from this blog

Spring Interview Preparation

Consuming wsdl into spring boot

Git-hub handy code