Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SOS! CALLING FOR HELP TO SEND XML THROUGH WEB 2

Status
Not open for further replies.

JenniReyniss

Programmer
Mar 23, 2010
12
IS
Hi everybody

I'm using WebService created in .NET and I'm calling it with VFP9.
There are two methods that I'm gonna use.
One to receive data and one to send data.
The one that I'm receive data works fine but when I try to send I got some problem.

When I look at the method in VFP (in the XML Web Services part) it says that the syntax for it is :
(Parameter names and such have been changed.)
Code:
SendXML(User AS string, UserPwd AS string, service AS string, receiver AS string, xml AS XMLDOMNodeList, UserMessage AS string) AS VOID
The information I got from the company that I'm trying to send to is that the code for the XML should be something like this (presumably with .NET in mind) :
Code:
<coolio_words xmlns="[URL unfurl="true"]http://www.company.com/schemas/inc/coolie/1"[/URL] message="string_1" sender="sring_2" system="strng_3">
   <customer_insert staff="string_4" ktl="string_5" reject="" batch="string_6" country="string_7">
      <customer cost="string_8" date="2001-01-01T00:00:00" costSystem="string_9" costName="string_10" />
   </customer_insert>
</coolio_words>
I have tried to find the solution for my problem and the closest thing I found is :

I create a form, put a button on it an in the click I drag the WebService in it from the toolbox.
In the code that comes automatically I put after the '* Call your XML Web service here.' this code here :
Code:
TEXT TO lcXML TEXTMERGE NOSHOW PRETEXT 7
   <coolio_words xmlns="[URL unfurl="true"]http://www.company.com/schemas/inc/coolie/1"[/URL] message_id="string_1" senderId="sring_2" systemId="strng_3">
      <customer_insert staffId="string_4" ktl="string_5" rejectReason="" batchID="string_6" countryCode="string_7">
         <customer cost="string_8" date="2001-01-01T00:00:00" costSystem="string_9" costName="string_10" />
      </customer_insert>
   </coolio_words>
ENDTEXT

leSend = loWebSevice.SendXML("something_1","something_2","something_3","something_4",lcXML,"something_5")
When I try this I get this error :

Error: 1429 - OLE IDispathc exception code 0 from Client: Client:Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057: The parameter is incorrect.
- Clinet:Unspecified client error. HRESULT=0x80070057: The parameter is incorrect.
..
Client:Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057: The parameter is incorrect.
- Clinet:Unspecified client error. HRESULT=0x80070057: The parameter is incorrect.


What am I missing or doing wrong?

After searching for solution and seeing some codes I consider if my problem is :
(despite of my lack off knowledge)
- should I use '< ?xml version = "1.0" ....' and then how?
- shouldn't I use 'TEXTMERGE' to send in XML (XMLDOMNodeList). And than what is the best / right way to do it?
- something about schema. Is it not identified or wrongly?
- something to do with 'diffgram'. Should I use it and than how?
- is there something missing or not identified?
- is the date making the error?

Please help me and if you need more information please let me know.
All help would be appraised.

With hope that this is just a missing '( )' problem or something simple as that.

With thanks in advance,
JensReyniss
 
What is SendXML()? It's not a standard VFP function, nor a method of the SOAP foundation class. It looks like it's specific to the web service you are calling.

If so, you need to check with the web service's documentation to find what parameters to pass.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Thanks Mike for your quick response

SendXML() is a method from the web service that I'm calling.

The parameters are :
User AS string
UserPwd AS string
service AS string
receiver AS string
xml AS XMLDOMNodeList
UserMessage AS string

This is the syntax information given when I look at this method in 'XML Web Services' in Task Pane Manager i VFP :
SendXML(User AS string, UserPwd AS string, service AS string, receiver AS string, xml AS XMLDOMNodeList, UserMessage AS string) AS VOID

I can fill in the string parameters but when it comes to the XMLDOMNodeList, then I'm lost !

Jenni
 
Would you try creating and sending an Xml node list. ie:

Code:
Local loDOM As "MSXML2.DomDocument", XML, lcXML

TEXT TO lcXML NOSHOW
   <coolio_words xmlns="[URL unfurl="true"]http://www.company.com/schemas/inc/coolie/1"[/URL] message_id="string_1" senderId="sring_2" systemId="strng_3">
      <customer_insert staffId="string_4" ktl="string_5" rejectReason="" batchID="string_6" countryCode="string_7">
         <customer cost="string_8" date="2001-01-01T00:00:00" costSystem="string_9" costName="string_10" />
      </customer_insert>
   </coolio_words>
ENDTEXT

loDOM = Createobject("MSXML2.DomDocument")
loDOM.LoadXML(m.lcXML)
XML = loDOM.documentElement.childNodes
SET STEP ON

leSend = loWebSevice.SendXML("something_1","something_2","something_3","something_4",m.XML,"something_5")

I actually suggest using .Net for sending/receiving from web services. You could create a .Net component that would do this for you and instead get/return simple types to you (like strings, xml). At least that is how I did web services after being frustrated by trying SOAP.

Cetin Basoz
MS Foxpro MVP, MCP
 
Thanks Cetin for your response

I tried to create and send an XML node list like you suggested but the same error pops up.

I have thought about turning to .NET but being a VFP programmer I want to try to solve this in VFP. Also my client is using VFP program where this XML should be send from.

But if you have any pointers (codes or links) how to do this in .NET, it will be highly appraised.

Respects,
Jenni
 
Doing that in .Net is easy and linking from VFP is easy too. I will compile a sample later today or this week that both sends and receives from a web service (maybe the one you showed if I knew the address and test values to use).

Cetin Basoz
MS Foxpro MVP, MCP
 
There are other ways to send/receive XML through VFP that do not involve .NET

There are ActiveX components that I use from Chilkat ( which do it for me easily and reliably (as long as the other end is working right). There are likely other 3rd party components out there as well.

If what Cetin provides does not work for you, you might want to consider going in that direction.

Good Luck,
JRB-Bldr
 
Thanks again Cetin
It will be good to have samples of how to do it in .NET. The address that I'm using is IP-protected so I can't send you the address. And as you can see in the codes above all values are strings except for the XML (XMLDOMNodeList).
Later this week would be fine. I have been in agony over this for weeks so few days more shouldn't kill me!

Thanks also to you JRB-Bldr
I downloaded what you suggested and I will take a look at it.

Respects,
Jenni
 
I will compile a sample later today or this week that both sends and receives from a web service

Cetin, I'm sure other folk here would like to see that.

By the way, is it safe to assume that all users will have .NET installed? It could be quite a big overhead to add to a VFP app's setup routine.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
The Weeb Service Proxy from Rick Strahl might also help to cope with this web service. ( Watch the video as a Quickstart Guide.

I think Mike Lewis already has the essential point about the XMLNodes parameter.

You might try XMLAdapter, load the XML into it and then pass on it's IXMLDOMElement subobject.

Bye, Olaf.
 
Thanks Olaf for your reply and suggestion

I watched the video and it seems to be a cool tool.
But I don't think it can help me with my problem.

I also tried to use XMLAdapter but the same error appear
This is how I used it :
Code:
LOCAL oXMLAdapter as XMLAdapter
oXMLAdapter = CREATEOBJECT("XMLAdapter")
XML = oXMLAdapter.LoadXML(lcXML)

leSend = loWebSevice.SendXML("something_1","something_2","something_3","something_4",XML,"something_5")

I also don't quite see what you mean by that Mike has the essential point about the XMLNodes parameter.
Please explain it me.

Hilsen,
Jenni
 
it would be helpful to see the wsdl but i would need the url to the web service.

EXAMPLE
this will give additional information about the parameters. If i am reading the error correctly it is complaining about the NUMBER of parameters sent. This error could be coming from the web service call or the sent XML node list.

Error: 1429 - OLE IDispathc exception code 0 from Client: Client:Incorrect number of parameters supplied for SOAP request

Steve Bowman
Independent Technology, Inc.
CA, USA
 
If i am reading the error correctly it is complaining about the NUMBER of parameters sent.

Steve, that was my interpretation as well. It's not a question of how the XML is created.

That said, it's always possible if the web service rejects a parameter for whatever reason (such as badly-formed XML), it will incorrectly report that as a missing parameter. I think I've seen that happen before, but I can't be sure.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Yes, I have seen that before myself but rather then go into all that yet. It would be helpful to see the wsdl.

Steve Bowman
Independent Technology, Inc.
CA, USA
 
Thank you Steve and Mike for your comments

The Web Servide is IP-protected so I can't send you the url.
But I could send you by e-mail files that includes the out come of the url.
I also try to send the files as attachment with this reply but if it doesn't work than I could send you it by e-mail and anyone that wants to help.

Best regards and many thanks for your time,
Jens
 
the attachment did not work so you can send that via email to steve at independenttech dot net. i will take a look at the wsdl

Steve Bowman
Independent Technology, Inc.
CA, USA
 
i use the wwHTTP class from west-wind, works perfectly
Code:
			loHTTP = CREATEOBJECT("wwHTTP")
			loHTTP.nHttpPostMode = 2

			loHTTP.AddPostKey("StoreID",m.StoreID)
			loHTTP.AddPostKey("XML",lcXMLFile)
			lcSuccess = loHTTP.HTTPGet(lcURL)

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
If you should decide to go with the Chilkat ActiveX components you might want to look at:

HTTP POST & GET examples
Chilkat Visual FoxPro Examples

They have worked well for me (as long as the remote end was working correctly).

Good Luck,
JRB-Bldr
 
Code:
loDOM = Createobject("MSXML2.DomDocument")
loDOM.LoadXML(m.lcXML)
XML = loDOM.documentElement.childNodes

or:

Code:
loDOM = Createobject("MSXML2.DomDocument")
loDOM.LoadXML(m.lcXML)
XML = loDOM.documentElement.getElementsByTagName("customer_insert")

should have worked. Maybe it is expecting to have coolio_words as a node too and then you're missing a parent element:

Code:
TEXT TO lcXML NOSHOW
<root>
   <coolio_words xmlns="[URL unfurl="true"]http://www.company.com/schemas/inc/coolie/1"[/URL] message_id="string_1" senderId="sring_2" systemId="strng_3">
      <customer_insert staffId="string_4" ktl="string_5" rejectReason="" batchID="string_6" countryCode="string_7">
         <customer cost="string_8" date="2001-01-01T00:00:00" costSystem="string_9" costName="string_10" />
      </customer_insert>
   </coolio_words>
</root>
ENDTEXT

loDOM = Createobject("MSXML2.DomDocument")
loDOM.LoadXML(m.lcXML)
XML = loDOM.documentElement.childNodes

* or
* XML = ; *   loDOM.documentElement.getElementsByTagName("coolio_words")

Anyway since I suggested to use a .Net 'bridging' component in between and promised to supply a sample I will show that in next post.



Cetin Basoz
MS Foxpro MVP, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top