All, Hope I can make this make sense if no one else has had to do this :-) ! I need to pass an Orbeon XForms xml "instance" to a custom processor and then have the custom processor call my java classes to convert the xml "instance" to a file (because it currently expects an xml file as input) then do something like: RequestEntity re = new InputStreamRequestEntity(new FileInputStream(file)); PutMethod method = new PutMethod(request); method.addRequest Header ("Content-Type", "application/octet-stream"); method.setRequestEntity(re) int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { System.out.println("method failed: " + method.getStaturLine()); } to build an HttpClient call to a REST web service then get a response back from the REST webservice. Questions: 1. How to convert the Orbeon XForms xml "instance" to a file and use the current code OR pass the Orbeon XForms xml "instance" directly (somehow) to a set of code that builds the REST web service call. In short, it needs to achieve the same thing as the streaming "application/octet-stream" in the code above which uses: RequestEntity re = new InputStreamRequestEntity(new FileInputStream(file)); 2. So, again, in summary: a. I have an Orbeon XForms xml instance that needs to be passed to a custom processor that then calls the Java classes that builds the REST HttpClient web service call (see java code above) which then returns a string. b. What is the best approach to achieve the same thing as using the code above? Thanks for any help, Randy Also, I sent this question earlier (which is related to the above one) but for some reason I was deleted from the ops mailing list and did not get a response. Hopefully I'm back on now. If someone answered the following question maybe it could be forwarded to me. ;-) Thanks, I'm trying to develop a custom processor that will call a suite of web services. I have the Java code used in another app and want to have an XForms app send an instance to the processor which in turn will pass the instance to the Java classes and then on to the proper web service. For the environment I have an Orbeon nightly build .war running under Tomcat. I say that because I'm not sure I have everything I need to get the Java code compiled. I read the documentation on the Java Processors but I have the following questions: 1. Do I have to have a /java directory somewhere (i.e. sourcepath= oxf./java) in the "resources" for the Java code to be compiled? 2. I have the files in a directory with the "apps" under the "resources" directory but it is not called /java. I cannot tell if the Java code is being compiled when I refresh the browser that executes my XForm. Thanks, Randy -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Hi Randy, Sorry for your earlier question that didn't make it to the list. We don't "delete" messages posted to the mailing list. If you are posting from your email client, after sending a message, you might to check http://n4.nabble.com/ObjectWeb-OPS-Users-f24843.html. In general it will show up there in the hour after you sent it. If it doesn't show up there, it means that other people subscribed to the list most likely have not received it either. If I understand your question well, you'd like to send XML from an XForms instance to a custom processor, then to some Java code that does a PUT of that XML to a URL. Instead you should be able to do that PUT directly from XForms using an XForms submission. Have you tried that? Is there anything you wanted to do in Java that you couldn't do with the xforms:submission? Alex
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Alex,
Thanks much for the reply. I'll try to explain in a nut shell where I am: 1. I've built an XML instance from data entered into an XForms form using Orbeon. 2. Now I need to do as you said, do a PUT to a URL which is really a call to a REST web service. a. What I am really puzzled about is how to "send" or "stream" or whatever, the XML instance to the web service. (1) The Java code I have works fine for doing the PUT and actually takes an XML file (e.g. instance.xml) complete with the path (e.g. c:temp/instance.xml) and builds the web service call. It does it with this code snippet along with other code: HttpClient client = new HttpClient(); RequestEntity re = new InputStreamRequestEntity(new FileInputStream(file)); PutMethod method = new PutMethod(request); method.addRequest Header ("Content-Type", "application/octet-stream"); method.setRequestEntity(re) int statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { System.out.println("method failed: " + method.getStaturLine()); }This Java code seems to STREAM (whatever that means :-( ) the instance.xml file over the net via HTTP using the Java library method(s) "RequestEntity re = InputStreamRequestEntity(new FileInputStream(file))". My ignorance here, does this do something exotic when it sees or is combined with "Content-Type", and "application/octet-stream" in the HTTP PUT that an Orbeon submission cannot do? I really just need to know if Orbeon XForms can do this and has everything necessary to achieve this in the Orbeon library? I want to achieve the same result as the Java code, if I can, with an Orbeon XForms submissions but I just do not know how. Another thing is that I am not clear on actually what the HTTP or URL PUT call looks like when it goes over the net to the REST web service. I admit on my part there is an ignorance factor here I'm trying to overcome. :-) The bottom line is if I can create a custom processor that calls a set of Java methods or achieve the same with an Orbeon submission it is really going to help my Orbeon XForms app. If I can get this to work I will be able to interface with our suite of web services which will open a new world to my XForms. Thanks much, Randy btw, tell Eric I said hello. He might remember me as the Orbeon newbie @ the ML conf last May. Alessandro Vernet wrote:
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Randy, Looking at the Java code, it doesn't look to like it is doing anything very particular that you could not do with an xforms:submission. I am surprised by the content type set to application/octet-stream, because what you are sending is really XML, so application/xml would be more appropriate. Is this a requirement of the service you are calling? It looks to me like you should be able to do the same directly from XForms with a submission that looks like: <xforms:submission method="put" mediatype="application/octet-stream" resource="http://... pointing to the URL of your service" replace="none"/> Alex
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Thanks Alex!
I'll see if I can use this to link up to the web services. Randy Alessandro Vernet wrote:
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
In reply to this post by Alessandro Vernet
You gave me this suggestion: <xforms:submission method="put"
mediatype="application/octet-stream"
resource="http://...
pointing to the URL of your service"
replace="none"/>
Thanks for that it helps!But I'm not sure how to map what is needed in the web service call to the XForms submission. Could you look at this call to the service (which is only partially correct because I don't know what it really looks like) and give me your input on what you think the XForms submission call might look like to do the same thing? Here is what (I think) the call could look like in java: http://midl/sourceservice/service.svc/uploadSourceReference/UTF-8 Here is what I tried but not sure yet if it is working: <xforms:submission
ref="instance('sourcereference-instance')"
id="source-service-submission" method="put"
mediatype="application/octet-stream" resource="http://midl/sourceservice/service.svc/uploadLocalSource"
replace="none"/>
Any ideas? Thanks! Randy Alessandro Vernet wrote:
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |