[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

Problem when pass the symbol '+' as a parameter from classic asp to a web service

Hi everybody,

I'm working with MSXML2.ServerXMLHTTP to use a web service from classic asp. I pass several parameters and everything is working good except when i try to pass a value with the symbol '+'. For example: a value like 'abc+def' is converted to 'abc def' and then it fails because of the validation.

This is my code:

    Set httpReq = New MSXML2.ServerXMLHTTP
    BookID = "1"
    Category = "cf+so"
   webServiceUrl = "http://localhost:1131/WS/MyWebService.asmx/Search?BookID=" & BookID
    webServiceUrl = webServiceUrl & "&Category=" & Category

    httpReq.Open "GET", webServiceUrl, False
    httpReq.send

    Set myXmlDoc = New MSXML2.DOMDocument
    If myXmlDoc.Load(httpReq.responseBody) Then
    .....

When i debug it..this is what the web service receive:    
BookID = "1", Category = "cf so"
As you can see the web service receive a blank space ' ' instead of '+' but i need the '+' to be passed.

Somebody know why is this happening? Any idea?

Regards.


0
richardhaeger
Asked:
richardhaeger
1 Solution
 
LordOfPortsCommented:
Try using the URLEncode method http://www.w3schools.com/asp/met_urlencode.asp , e.g.:

webServiceUrl = webServiceUrl & "&Category=" & Server.URLEncode(Category)
0
 
richardhaegerAuthor Commented:
It worked...
Thank you very much!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now