liuhaipeng905 / servicestack

Automatically exported from code.google.com/p/servicestack
0 stars 1 forks source link

Incorrect url generated for JSON and JSV client in v1.38 #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Create a console client and a use the built in webserver in VS2010 to host 
the web service
2.Made a call to the webservice and you will get bad request.

What is the expected output? What do you see instead?
response from webservice.  instead you get bad request.  using TCPMon you can 
see that JsvServiceClient and JsonServiceClient with a base address of 
"http://localhost:8080/Public/" request /Public/Jsv/SyncReply//GetFactorial 
instead of /Public/Jsv/SyncReply/GetFactorial.  With the extra / in the request 
the webserver returns Bad Request message instead of the result. Please not 
removing the extra / does make the service work.

What version of the product are you using? On what operating system?
v1.38 on VS2010 built in web server

Please provide any additional information below.
I have no idea why the extra / is added to the URL but hopefully it is not to 
hard to fix.  I have included the error page as an attachment.

Original issue reported on code.google.com by gilligan...@gmail.com on 29 Jul 2010 at 12:17

Attachments:

GoogleCodeExporter commented 9 years ago
The mistake is in ServiceClientBase line 47. It currently is 
var requestUri = this.SyncReplyBaseUri + "/" + request.GetType().Name;
and it should be
var requestUri = this.SyncReplyBaseUri.WithTrailingSlash() + 
request.GetType().Name;
the reason is several lines above you add a slash tot he end of the url and 
this line would just add another in some cases

Original comment by gilligan...@gmail.com on 29 Jul 2010 at 9:15

GoogleCodeExporter commented 9 years ago
sorry noticed you applied the fix i talked about above and when i checked i 
realized the other method also has the same problem but since i have not sued 
it i did not notice.  line 78

Original comment by gilligan...@gmail.com on 30 Jul 2010 at 9:37

GoogleCodeExporter commented 9 years ago
Hi yeah sorry I haven't got back to you sooner, I've been rather busy and only 
been able to apply that quick fix you mentioned - thanks btw :)

Unfortunately I'm mid way through adding some new functionality in ServiceStack 
so wont put out a new binary release until I've finished, so you'll have to 
build it from source for the time being. I'll update this thread once I have 
done so.

Thanks for reporting!

- Demis

Original comment by demis.be...@gmail.com on 30 Jul 2010 at 11:05

GoogleCodeExporter commented 9 years ago
Any chance you could email me the build with the fix or tell me how to build 
the source.  When i tried to build it i could not get it to produce the 3 dll. 
I got a lot of errors with the bat files and the nant script did not seem to do 
anything so sort of gave up. If not that is ok i will just copy the client into 
my own dll.

Original comment by gilligan...@gmail.com on 30 Jul 2010 at 11:44

GoogleCodeExporter commented 9 years ago
Hi no worries please find the new binaries attached.
Hopefully for other people to build you just need to:

- Rename env-vars.bat.rename to env-vars.bat and change the 'BASE_PATH' to the 
path where you have checked out ServiceStack.
- Build ServiceStack.Common.sln in 'Release' mode
- Run '%BASE_PATH%\Common\ServiceStack.Common\Build\ilmerge-all.bat'
- Find the merged dlls in '%BASE_PATH%\release\latest'

Original comment by demis.be...@gmail.com on 31 Jul 2010 at 12:01

Attachments:

GoogleCodeExporter commented 9 years ago
I'll close this issue since this fix is now in the latest version of 
ServiceStack.

Original comment by demis.be...@gmail.com on 11 Aug 2010 at 3:13