0
votes

I have a web service that gets a string as parameter and returns string. This service is located on server1. On server2 I have a little (2 line) console application to test this web service and everything works ok. When I call the same web service (using the same settings - no settings, url is the same, everything about web service part is the same) I get "400 bad request" error. In the same function I have something like this:

using(var ctx = ClientContext(siteUrl)) //  sharepoint client object model
{
   using(var db = SomeEntitiesContext()) // entities context
   {
       ...
       var webservice = MyService.MyServiceClass();

       foreach(var item in items)
       {
           var res = webservice.MyMethod(myinput); //here I get 400 bad request error
       }
   }
}

Is it possible that other contexts have mixed up something? It's strange that a console based testing app is working.

1
The easy answer is to use a tool like Fiddler to watch the internet traffic between client and server and spot the differences. - Mark Mascolino

1 Answers

2
votes

It was something with the string that I get from DB vs hardcoded (the same string from DB)... I changed web service so it gets byte array insted of string and now it works.