Reputation: 103
I am consuming a web service with http and it is soap based service , on response it gives error with http code 500 . any idea why so?
soap body is as
queryNameAvailability request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:uri="uri:v2.external.query.name.availability.asic.gov.au" xmlns:oas="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:uri1="uri:business.document.header.types.asic.gov.au" xmlns:uri2="uri:fss.types.asic.gov.au" xmlns:uri3="uri:types.asic.gov.au" xmlns:uri4="uri:nni.types.asic.gov.au">
<soap:Header/>
<soap:Body>
<uri:request>
<uri1:businessDocumentHeader>
<uri1:messageType>queryNameAvailability</uri1:messageType>
<uri1:messageReferenceNumber>cnr 1</uri1:messageReferenceNumber>
<uri1:messageVersion>2</uri1:messageVersion>
<uri1:senderId>234</uri1:senderId>
<uri1:senderType>REGA</uri1:senderType>
</uri1:businessDocumentHeader>
<uri:businessDocumentBody>
<uri4:proposedName>CNR</uri4:proposedName>
<uri4:companyNameAvailabilityCheck>true</uri4:companyNameAvailabilityCheck>
</uri:businessDocumentBody>
</uri:request>
</soap:Body>
</soap:Envelope>
queryNameAvailability cnr 1 3e9527dc-71fa-4103-bbb3-eb8d4221573a 2 ASIC GOVT ASIC Business Names 1 2014-12-19T09:08:03 ASIC true Available CNR is available.
C# code is as
String user = "username";
string pwd = "password";
NetworkCredential creds = new NetworkCredential(user, pwd);
StreamReader reader = new StreamReader((Server.MapPath("").ToString() + "\\XMLFile1.xml").ToString().Replace("Home\\",""));
string soap = reader.ReadToEnd();
byte[] bytess = System.Text.Encoding.ASCII.GetBytes(soap);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.gateway.uat.asic.gov.au/gateway/ExternalQueryNameAvailabilityPortV2?WSDL");
request.Credentials = creds;
request.Method = "POST";
request.ContentType = "text/xml; charset=utf-8";
request.ContentLength = bytess.Length;
Stream oss = request.GetRequestStream();
oss.Write(bytess, 0, bytess.Length);
WebResponse response = request.GetResponse();
on response the server error founds with code 500
Any Idea what is the reason of error ?
Upvotes: 1
Views: 1098
Reputation: 103
While calling service , the url should not include the '?WSDL' at the end as it is only to check the detail of the service
Upvotes: 1