Quantcast

Reading from a WCF Service onto Orbeon forms

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Reading from a WCF Service onto Orbeon forms

RameshBhat
Hi,

Can we connect to a WCF service to read values from and assign it to controls in orbeon forms.

Regards
Ramesh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

Alessandro  Vernet
Administrator
Hi Ramesh,

My understanding is that WCF is a Microsoft technology you can use to implement web services. So, yes, you should be able to call those services from Orbeon Forms, just like any other service, irrelevant of the technology used to implement them.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

RameshBhat
Hi,

Thanks for the reply. Can you let me  know with an example as to how I can connect to a specific method in WCF.

In Web service we can just call the method name in the URL itself and configure the same in orbeon, however in WCF I am not sure whether you can do the same. (possible instantiation of the client required)

An example would be helpful.

Regards
Ramesh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

Alessandro  Vernet
Administrator
Hi Ramesh,

Do you have a way to test the service? If you do, I would do a call to the service, look at what XML is sent to the service, if needed using a tool like Charles (https://www.charlesproxy.com/), use the XML sent to the service in Form Builder. You'll let us know if you're having any success with this,

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

RameshBhat
Hi,

Thanks for ur reply.  I have uploaded a sample WSDL file that gets generated on calling the service. Also attached the screen shots that we get when calling through the UI in orbeon (if that helps).


scroll1.pngScroll2.png
WSDL.txt
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

Alessandro  Vernet
Administrator
Hi Ramesh,

In the screenshot, I see the message "Use the 'client' variable to call operations on the service", but this isn't an error message, as I first thought, but code returned by the server, that I found in sample code returned by the service:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/e7f1c018-4b1a-4933-b99e-3e8415a9c8b1/could-not-call-wcf-service-through-url?forum=wcf

Have you tried, independently of Orbeon Forms, to write such a client, e.g. in C#, to check if you can call the service?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

RameshBhat
Hi,

Thanks for replying.

In C#, we have to create a instantiation of the client object (create a proxy) and then access the service, we cannot call it through a URl like how we call webservices.

I wanted to know how do we call such a service exposed, do we have to write code in orbeon or is there some other way to achieve this.


Regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

Alessandro  Vernet
Administrator
Ramesh, but I imagine that the C# client code you write is itself making an HTTP call. What I suggest is that you run that code, look at what call it makes (what SOAP envelope it sends), e.g. using Charles, and then use that SOAP envelope in Form Builder.

Another way to bridge the gap is to ask: how would you call your service from the command line with curl (a common common line HTTP client)? If you can successfully call the service with curl, we'll have a "common language": post here the command you used, and we'll be able to do tell you if it is possible to do the same from Form Builder, and assuming it is, how to it.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

RameshBhat
Hi,

Kindly find attached the Request and the response attached when called from a WCF Test Client.

Note: WSDl is an xml file

response.txt
wsdl.txt
request.txt

Also can you let me know what settings are required for the service to be fired upon.

Regards


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

Alessandro  Vernet
Administrator
Hi Ramesh,

Thank you for the information.

1. What happens if, in Form Builder, you create an HTTP Service, in the "Resource URL" you put http://localhost:5917/AccountTypeService.svc (from the WSDL, I imagine this is the endpoint for your service), use a POST, in the "Request Body" put the content of your request.txt, and hit the "Test" button?

2. If this doesn't work, can you try calling the service with curl? This will ensure that your service is callable by something other than WCF's own client, and once you have the appropriate curl command line to use will give us a "common language" to discuss this.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

RameshBhat
Hi,

I have managed to simulate the response to the following:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetAccountsResponse xmlns="http://tempuri.org/">
<GetAccountsResult xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:string>AccountA</a:string>
<a:string>AccountB</a:string>
<a:string>AccountC</a:string>
</GetAccountsResult>
</GetAccountsResponse></s:Body>
</s:Envelope>

If I have to bind the same to any control (drop down list), what is the expression I need to use?

Regards
Ramesh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reading from a WCF Service onto Orbeon forms

Alessandro  Vernet
Administrator
Ramesh, in the Actions Editor dialog, under "Set Response Selection Control Items", you choose the control you want to populate, and in this case you could use:

Items: //*:GetAccountsResult/*:string
Label: .
Value: .

In this case both the label (what is shown to users in the dropdown) and the value (what is stored in the data) are the same, hence the `.` (period).

I hope this helps,

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Loading...