vb.net - HTTP Web request 500 Internal Server error? -


am making call webservice soapexception error responds "the remote server returned error: (500) internal server error" when use wireshark or fiddler status error,status code , status description of error not "the remote server returned error: (500) internal server error". how can these error information directly vb2010

sub readsoap()      dim webrequest httpwebrequest     'dim reader streamreader     dim response httpwebresponse = nothing     dim result string     dim data string = ""     dim url string = ""     dim xdoc new xmldocument     result = ""     textbox1.text = ""     dim xml string = ""      xml = "<soapenv:envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:v1=""http://xmlns.bb.com/request/v1"" xmlns:v3=""http://xmlns.bb.com/requestheader/v3"" xmlns:v2=""http://xmlns.bb.com/parametertype/v2"">" _     & "<soapenv:header xmlns:wsse=""http://aaa.bb-open.org/wss/2004/01/aaa-200401-wss-wssecurity-secext-1.0.xsd"">" _       & "<wsse:security>" _          & "<wsse:usernametoken>" _             & "<wsse:username>{8}</wsse:username>" _             & "<wsse:password>{9}</wsse:password>" _          & "</wsse:usernametoken>" _       & "</wsse:security>" _    & "</soapenv:header>" _              & "<soapenv:body>" _               & "<v1:brequest>" _                & "<v3:requestheader>" _                 & "<v3:information>" _                  & "<v3:id>{0}</v3:id>" _                  & "<!--optional:-->" _                  & "<v3:traid></v3:traid>" _                  & "<v3:count>r</v3:coun>" _                  & "<v3:corid>3465fgfrwsdss</v3:corid>" _                 & "</v3:information>" _                & "</v3:requestheader>" _                & "<v1:requestbody>" _                 & "<v1:action>{10}</v1:action>" _                 & "<!--optional:-->" _                 & "<v1:deb>{1}</v1:deb>" _                 & "<v1:cre>{2}</v1:cre>" _                 & "<v1:am>{3}</v1:am>" _                 & "<!--optional:-->" _                 & "<v1:tid></v1:tid>" _                 & "<!--optional:-->" _                 & "<v1:inid></v1:inid>" _                 & "<!--optional:-->" _                 & "<v1:addiparam>" _                  & "<v2:parametertype>" _                   & "<v2:parametername>{4}</v2:parametername>" _                   & "<v2:parametervalue>{5}</v2:parametervalue>" _                  & "</v2:parametertype>" _                  & "<v2:parametertype>" _                   & "<v2:parametername>{6}</v2:parametername>" _                   & "<v2:parametervalue>{7}</v2:parametervalue>" _                  & "</v2:parametertype>" _                 & "</v1:addiparameters>" _                & "</v1:requestbody>" _               & "</v1:brequest>" _              & "</soapenv:body>" _             & "</soapenv:envelope>"      url = "http://123.456.78.5548:5545/abc/serv/custinfo"     webrequest = directcast(system.net.webrequest.create(url), httpwebrequest)     webrequest.method = "post"     webrequest.usedefaultcredentials = false     webrequest.proxy = ctype(nothing, iwebproxy)     webrequest.contenttype = "application/x-www-form-urlencoded"     dim postdata string = string.format(xml, "req", "123", "443", 100, "wedge", "0002", "con", "prep", "", "", "")     webrequest.contentlength = postdata.length     webrequest.keepalive = true      'try     dim writer new streamwriter(webrequest.getrequeststream(), system.text.encoding.ascii)     writer.write(postdata)     writer.close()     response = directcast(webrequest.getresponse(), httpwebresponse)     if response.statuscode = httpstatuscode.ok         xdoc.load(webrequest.getresponse().getresponsestream()) ' fast         txtresponse.text = xdoc.innertext     end if      'catch ex exception     'txtresponse.text = ex.message     ' end try end sub 

instead of:

 if response.statuscode = httpstatuscode.ok      'rest of code  end if 

why don't do:

select case response.statuscode       case httpstatuscode.ok     'handle ok      case httpstatuscode.internalservererror    'handle server error accessing error message returned      case ... 'another status code  end select 

Comments

Popular posts from this blog

Error while updating a record in APEX screen -

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

ios - Xcode 5 "No such file or directory" -