Could you clear what is and what is causing this VFP XML Web Service, correctly registered when running?

Hi Experts

Could you clear what is and what is causing this VFP  XML Web Service, correctly registered when running?

 img003
if the line
leResult = loHello_Port.sayHello('xxx')

Open in new window

is ommited - no problems arises

if the line is changed to:
leResult = loHello_Port.sayHello()

Open in new window

this error arises

img004
The XML
<definitions name = "HelloService"
   targetNamespace = "http://www.xxxxx.com.br/soap/HelloService.wsdl"
   xmlns = "http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:tns = "http://www.xxxx.com.br/wsdl/HelloService.wsdl"
   xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
 
   <message name = "SayHelloRequest">
      <part name = "firstName" type = "xsd:string"/>
   </message>
	
   <message name = "SayHelloResponse">
      <part name = "greeting" type = "xsd:string"/>
   </message>

   <portType name = "Hello_PortType">
      <operation name = "sayHello">
         <input message = "tns:SayHelloRequest"/>
         <output message = "tns:SayHelloResponse"/>
      </operation>
   </portType>

   <binding name = "Hello_Binding" type = "tns:Hello_PortType">
      <soap:binding style = "rpc"
         transport = "http://schemas.xmlsoap.org/soap/http"/>
      <operation name = "sayHello">
         <soap:operation soapAction = "sayHello"/>
         <input>
            <soap:body
               encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"
               namespace = "urn:examples:helloservice"
               use = "encoded"/>
         </input>
		
         <output>
            <soap:body
               encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/"
               namespace = "urn:examples:helloservice"
               use = "encoded"/>
         </output>
      </operation>
   </binding>

   <service name = "Hello_Service">
      <documentation>WSDL File for HelloService</documentation>
      <port binding = "tns:Hello_Binding" name = "Hello_Port">
         <soap:address
            location = "http://www.xxxxcom.br/SayHello/" />
      </port>
   </service>
</definitions>

Open in new window


Thanks in advance!
Eduardo FuerteAsked:
Who is Participating?
 
Olaf DoschkeConnect With a Mentor Software DeveloperCommented:
You get a problem with this line?
leResult = loHello_Port.sayHello('xxx')

Open in new window

I read that you don't have a problem, only when you omit the parameter.

It's hard to help you without knowing what service you're using. For the moment you can refrain from telling, if you fear traffic to your site or hacking. I would need to install Soap Toolkit before getting to this Tooling to register a webservice with Task Pane.

If you know the server side of this webservice is .NET, go for https://west-wind.com/wsdlgenerator/. What VFP offers is outdated legacy Soap 1.0 based webservices. whereas Rick Strahl says his proxy works with 1.1 and 1.2.

Of course completely removing the line you don't have problems with the web service, you don't use it at all anymore. But when the message doesn't work in general you simply have the problem VFP works with outdated legacy Soap ways not valid for this web service implementation.

If you look into _ws3.h you see the classes VFP uses for web service consumption:
MSSOAP.SoapClient30
MSSOAP.WSDLReader30
MSSOAP.SoapReader30
msxml2.domdocument.4.0
All of which are outdated.

Today MS supports .NET webservices, and even if there would be 40 or even higher version of these MSSOAP OLE classes, the .NET web service approach is not available via soap OLE helper classes at all.

If the webservice is Java, you even have the next basis for webservice.

In theory Soap is Soap, but all this VFP construct is outdated, Soap also has changed over time with the version.

Bye, Olaf.
1
 
pcelbaCommented:
Sorry, I am not using XML Services. Or maybe just once in my FoxPro programming life...

This service returns "Host not found" error description for me so the response is a little bit different than yours but that does not help...

The line  leResult = loHello_Port.sayHello()  raises correct message saying "Parameter is missing".
The line  leResult = loHello_Port.sayHello('xxx')   seems to be correct just the WSDL service compatibility to VFP seems to be the problem.

What I would try here is a simple C# or VB.NET application accessing the service where we could expect better compatibility.
0
 
Eduardo FuerteAuthor Commented:
Hi

So  to use XML Web Services by using VFP maybe is not a good option.,

It's  Task Pane  funcionality seens to be very well made to make it works fine... but unfortunatelly it doesn't.

What I have been using is to send from VFP to a php page,no related to a XML service, that works like a service, coding like that:

ComProp(loRequest,'UTF8',1)
loRequest.open("POST","http://www.xxxxx.com.br/xxxxx_sistema_esp.php",.f.)
loRequest.SetRequestHeader('Content-Type','application/x-www-form-urlencoded')
m.envia = "?envia=xxx&sistema=PESSOAS&key="+m.lic_code+"&client="+m.lic_instit
loRequest.send(m.envia)

Open in new window

0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
pcelbaConnect With a Mentor Commented:
Yes, POST requests are easier to manage but we should wait for Olaf as I am sure he knows more about this stuff.

To properly use WSDL service we would need more investigations and maybe the best way would be to write some simple service in VS and try to call it from VFP.  This would allow to debug it and test what everything it needs.

Another solution is to write your own COM object in C# and let this COM object call the WSDL service and return results suitable for VFP. Everything this is a good start with C# which must happen sooner or later independently on us...

Just to be clear: I did not write any C# COM application yet. But I should do it.
0
 
Eduardo FuerteAuthor Commented:
Insisting a little more in VFP.

What do you think about to develop a VFP COM Server DLL to do the job instead of C# ?
0
 
pcelbaCommented:
VFP COM Server does not help here most probably as it cannot do better job than standard VFP application. So if something does not work in VFP the VFP COM cannot make it working.

The C# was mentioned because it could be more compatible with WDSL service than VFP.  And to make C# COM object compatible to VFP should then be relatively easy as it would be your C# code.
0
 
Olaf DoschkeSoftware DeveloperCommented:
What the error you get states is simply, that the sayHello method of the web service you use here needs a parameter.

So take a step back for understanding. Your loHello_Port object is your reference to the core web service, in detail, it's a local proxy object, that forwards all your method calls via XML soap messages to the online web service, receives the soap response and unwraps it to a local result. All that happens behinds the scenes and might work might fail.

Your error doesn't seem to point out a fundamental problem; you just experience something you don't experience in any method you could write in VFP: This sayHello method has a parameterization (or also called parameter signature) with a non-optional parameter. If you write LPARAMETERS tcString in a VFP function, you don't enforce, and you even can't force the caller of that method to provide a parameter value. A web service can. VFP will tell you PCOUNT() is 0 and tcString is .F. if that's the case. You then could ERROR "Incorrect number of parameters" and would cause a similar error to a caller not passing in tcString.

And that's all that happens here. That error tells you what it says and I don't see anything to misunderstand about this. When you want to call sayHello, you have to do it WITH a parameter value, variable/value type must be a string.

The syntax description tells you this parameter you pass in is a first name. It doesn't tell you this is a non-optional parameter, but the error tells you now. So what's a difficulty about that?

You're at an error that's not a fundamental problem of the web service not working out in general, like not being able to connect. You already are getting an error about the wrong usage of the object you have at hand.

So simply don't call sayHello() without a parameter. And notice even once you get some web service to work in general, you still also have to know and learn how the methods of this web service work for you, like with any third party libraries or classes you use, there is surely a getting started, howto tutorial or detailed explanation on top of the syntax description VFP technically receives with the WSDL web service description.

You actually have no problem at all, just read the core error message and you know you have to pass in a first name. I feel I just read to you what you can read yourself. Are you really distracted from all the surrounding extra information making this error message so cryptic? Why? It's just extra info not so important because the message is very clear, isn't it? In very short it politely gets back to you stating: "If you want me to say hello to you, please tell me your name." That's all there is to it.

Don't panic, just because error messages are more verbose.

Bye, Olaf.
0
 
pcelbaCommented:
Hi Olaf,

did you note the parameter and error message on the first image? That's what this question is about :-).

P.C.
1
 
pcelbaCommented:
Thanks Olaf!

The Web Service Proxy Generator seems to be the solution for Eduardo. It is exactly the piece of code I've recommended to write in C# (post ID: 42500546).

Pavel
0
 
Olaf DoschkeSoftware DeveloperCommented:
Yes, Rick Strahl years ago already took the idea to program a proxy of a specific web service to a more general proxy of any web servicewith this generator.

Bye, Olaf.
0
 
Eduardo FuerteAuthor Commented:
Thank you for replies by now.

I'm just trying to test it!
0
 
pcelbaCommented:
Good reason to visit Rick on Hawaii :-)
0
 
Eduardo FuerteAuthor Commented:
LAL

I just returned from a small trip here in Brazil, São Paulo State... so the delay...

With some dangerous intercorrences.

Brazilian snake...
0
 
pcelbaCommented:
Hmm ZOO everywhere... We have just small vipers and grass snakes here. And -6 °C now.
0
 
Eduardo FuerteAuthor Commented:
Hardest to support -6°C than deal with this snake...rsrs
0
 
Eduardo FuerteAuthor Commented:
Thank you for the assistance!

I'm still testing and having some dificulties. So I'm going to return to a new question abaout it.
0
 
Eduardo FuerteAuthor Commented:
The new question is:

West Wind config
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.