NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Wolfgang Orth on May 28, 2015, 12:46:54 PM
-
Hello Bruce and others,
I want my SOAP-Server to return one value. This is what I get back into the Client and it looks fine:
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...>
<soap:Body>
<getAnmeldemethode_Response xmlns="">
<Anmeldemethode>1</Anmeldemethode>
</getAnmeldemethode_Response>
</soap:Body>
</soap:Envelope>
How do I get that single value of "Anmeldemethode" into a variable of the Client?
All I see is xml.LOAD( FILE / QUEUE / GROUP, ....).
In my case its just a plain variable.
What I already tried was to make a GROUP with one component. That component is "Anmeldemethode", Apparently I made that wrong. >:(
MyGroup GROUP,PRE(MyG)
Anmeldemethode STRING(1) !1 = Automatisch oder 2 = mit Passwort
END
In .PageReceived I have this:
xml.Load(MyGroup, WebClient.page, WebClient.pagelen, 'getAnmeldemethode_Response', 'Anmeldemethode')
MyG:Anmeldemethode should hold a 1 now, but does not, of course.
Thanks in advance,
Wolfgang
-
If you just wanted to return one value then I'd just use a StringTheory.Between method;
This in the client, in .PageRecieved;
str.SetValue(self.page,st:clip)
Anmeldemethode = str.Between('<Anmeldemethode>','</Anmeldemethode>')
Cheers
Bruce
-
Oh yes, that should do it! I did not see this solution last nicht, was too close. <g>
Thanks, Bruce!
Now I need to find out, why passing the GROUP did not work..... just for the next time when I need that.
-
Hi Wolfgang,
I think it's your file and record boundaries. It can be a bit tricky to get them right.
Peter
-
Yes, Peter, I struggle each time with that bounderies. In this case I have hoped that I had copied the right snippet.
OTOH, how boring life would be, if ecerything would work at the first attempt.......
-
I didn't have access to Clarion in my last response, now I do.
There are two problems with your example: 1) you cannot use <getAnmeldemethode_Response xmlns=""> as a boundary because it doesn't have a closing tag that matches (because of the xmlns= thing). 2) don't use Anmeldemethode as boundary either since that's a field in your group.
Since you're in control of the server as well, I'll suggest that you wrap your answer in a label (set file boundary) so that the file will look like this (without the SOAP part):
<getAnmeldemethode_Response xmlns="">
<Antwort>
<Anmeldemethode>1</Anmeldemethode>
</Antwort>
</getAnmeldemethode_Response>
Your group definition is fine as it is and the following line of code will load your field:
xml.Load(MyGroup,self.page,len(clip(self.page)),'Antwort','')
Peter
-
> I'll suggest that you wrap your answer in a label (set file boundary)
That makes sense, Peter!
I will try that soon.
Right now I struggle with UPPERCASE in the XML-tags.
Yesterday it worked all fine. Today I continued on another part of the App and all is broken.
I really wonder who altered my code over night........ ;D
Thanks for the explanation!
-
xml.TagCase = XF:CaseAny
-
> xml.TagCase = XF:CaseAny
That one is gracefully ignored by my App. ::)
However, there is also a good chance that I overlook something important. Maybe I delved too deep and need some distance now.
OTOH I need to continue and do some progress. <yadda-yadda>
;-)