NetTalk Central

Author Topic: SOAP Server: Empty xmlString string  (Read 4548 times)

GFasolt

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • GFasolt.com
    • Email
SOAP Server: Empty xmlString string
« on: November 25, 2008, 10:54:19 AM »
Using xFiles-less web42 example, my GetInfo() procedure begins as in the code below. The MESSAGE() function shows the xmlString to be empty. It appears I've omitted something. Suggestions?

Code: [Select]
  CODE
  GlobalErrors.SetProcedureName('GetInfo')
  do OpenFiles
  p_web.SetValue('_parentPage','GetInfo')
  p_web.publicpage = 1
  if p_web.sessionId = 0 then p_web.NewSession().
  do Header

  xmlString        = p_web.GetValue('xml')
  xmlLength        = LEN(CLIP(xmlString))

  MESSAGE('xmlString:|' & CLIP(xmlString), 'GetInfo')

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: SOAP Server: Empty xmlString string
« Reply #1 on: November 25, 2008, 10:14:37 PM »
Presumably there is no incoming parameter called xml?

If you look on the server window, at the log, what does the incoming request look like?

Cheers
Bruce

GFasolt

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • GFasolt.com
    • Email
Re: SOAP Server: Empty xmlString string
« Reply #2 on: November 26, 2008, 04:24:21 AM »
I've tried p_web.GetValue('Role') but it returned an empty string.

Code: [Select]
POST /GetInfo HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Accept-Language: en
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: 127.0.0.1:88
Content-Length: 305
Pragma: No-Cache
Cache-Control: No-Cache
Connection: Keep-Alive
SOAPAction: "http://127.0.0.1:88/GetInfo"

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><GetInfo/"><Role>Student</Role><Number>2</Number></GetInfo></soap:Body></soap:Envelope>

BTW, I have searched the docs for GetValue() several times but just am not finding anything helpful.

Also, how can I obtain the entire request string?
« Last Edit: November 26, 2008, 04:28:19 AM by GFasolt »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: SOAP Server: Empty xmlString string
« Reply #3 on: November 27, 2008, 11:19:40 PM »
Hi Greg,

Parameters passed via the request are automatically parsed out and stored in the Value queue.
A parameter can arrive in one of 3 ways;
a) as a cookie
b) as part of the URL - for example  www.capesoft.com?id=4 would result in p_web.GetValue('id') returning '4'.
c) as the "data" part of the Post - when it is in the format x=1&y=2&z=3 and so on.

As you can see your XML packet is really none of these. The data is clearly in the data pasrt of the post, but it's not using the HTML format. Rather it's just a big XML packet.
So clearly the above won't really help you.

But there are 2 approaches you can take.

a) the whole request is stored in p_web.RequestData.DataString. So you can parse that out by hand easily enough. typically you can find the start of the "data part" by searching for CR/LF/CR/LF. eg

x = instring('<13,10,13,10>', self.RequestData.DataString, 1, 1)

b) there is a special case handled as well. If the incoming request has the Content-Type item in the header set to 'text/xml' then the engine will automatically parse out the xml packet and place it in a special value (called 'xml').
In that case the big xml string is in p_web.GetValue('xml')

note that your packet below does _not_ include this header though so you would not be able to use this technique (unless you changed the request to include the content-type: header.)

One last thing worth mentioning :
GetValue does not look "inside" the xml packet at all - that job is for the XML class.

Cheers
Bruce

GFasolt

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • GFasolt.com
    • Email
Re: SOAP Server: Empty xmlString string
« Reply #4 on: December 01, 2008, 04:17:49 PM »
Thanks, Bruce!

This was just what I was looking for. If it's in the docs, I didn't find it. If not, maybe it should be?

Greg