0

I have generated the stub files through wsimport from the remote wsdl and have created a standalone client. Now when I am running the client, the HTTP request that is produced is this :

HTTP Header:

---[HTTP request - http://www.transportdirect.info/EnhancedExposedServices/CarJourneyPlannerSynchronous/v1/CarJourneyPlannerSynchronousService.asmx]---
Content-type: text/xml;charset="utf-8"
Soapaction: "http://www.transportdirect.info/TransportDirect.EnhancedExposedServices.CarJourneyPlannerSynchronous.V1/GetGridReference"
Accept: text/xml, multipart/related, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

HTTP Body:

<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken>
        <wsse:Username>USERNAME</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </S:Header>
  <S:Body>
    <GetGridReference xmlns="http://www.transportdirect.info/TransportDirect.EnhancedExposedServices.CarJourneyPlannerSynchronous.V1">
      <transactionId>bfe2ccbe-9197-4992-9073-cd3a3c0e5c47</transactionId>
      <locationType>Postcode</locationType>
      <locationValue>W11</locationValue>
    </GetGridReference>
  </S:Body>
</S:Envelope>

Now, the SOAP Envelope part is perfectly alright as I have tested it with SOAP tools and have got correct output. But the above HTTP request is always giving me

---[HTTP response - http://www.transportdirect.info/EnhancedExposedServices/CarJourneyPlannerSynchronous/v1/CarJourneyPl
annerSynchronousService.asmx - 500]---
null: HTTP/1.1 500 Internal Server Error
Cache-control: private
X-ua-compatible: IE=EmulateIE7
Content-type: text/html; charset=utf-8
Content-length: 7424
Connection: close
X-powered-by: ASP.NET

followed by lots of html tags, describing some error.

My Java client code looks like this -

CarJourneyPlannerSynchronousService service = new CarJourneyPlannerSynchronousService();
port = service.getCarJourneyPlannerSynchronousServiceSoap();
port.getGridReference(transactionId, "bla-bla", "bla-bla");

Can you please tell me what am I missing here ? Please let me know if you want to see more code.

somakd
  • 15
  • 7

1 Answers1

1

Pay attention on the line:

HTTP/1.1 500 Internal Server Error

It indicates that something on the server side went wrong. Check the server log and you'll find the cause of the error.

If you don't have access to the server, take a look at the documentation of the Web service and check whether you sent some inappropriate parameter which could cause server to crash (very improbable since you mentioned that you tested SOAP request with other tools). I suspect on the soapaction field in your HTTP header because .NET-based Web services often have problems with it - if you send a value that they don't expect, you can get error 500.

References:

Community
  • 1
  • 1
Miljen Mikic
  • 14,765
  • 8
  • 58
  • 66
  • Thanks Miljen. Your suggestion helped me in sniffing around. The HTTP Request URL being targeted is wrong. Now these are all wsimport generated java files, except for my Java code above - where in the code do I change the service URL ? – somakd Aug 29 '12 at 10:21
  • You can change the service URL in (at least) two ways, take a look at this great answer: http://stackoverflow.com/questions/2490737/how-to-change-webservice-url-endpoint – Miljen Mikic Aug 29 '12 at 10:32