Re: Wanting to return an .XML document for a direct action
Re: Wanting to return an .XML document for a direct action
- Subject: Re: Wanting to return an .XML document for a direct action
- From: Greg Hulands <email@hidden>
- Date: Thu, 6 Oct 2005 17:18:19 +1000
appendToResponse is declared in WOElement. It gets called
automatically in the Request - Response Loop. If you want to override
the default behaviour, then you override it in you class. If you
just remove the appendToResponse call in your constructor, all will
be fine.
Regards,
Greg
On 06/10/2005, at 5:08 PM, WebObjects wrote:
Thanks Greg (but now I'm just a tad unclear on where and how to
inject the
'append')
After reading a bunch on appendToResponse it looks like a
WOComponent can
invoke this, so I started crafting my first attempt at appending a
response
(sample immediately below). But I'm unclear on where to acquire
the current
response object to pass as a reference to the overridden
appendToResponse
method. Can anyone point me in the right direction? (as always,
greatly
appreciated!)
-Bill
//my attempt listed immediately below this line...
public class Main extends WOComponent {
public Main(WOContext context) {
super(context);
appendToResponse(this.response, context);
}
public void appendToResponse(WOResponse response, WOContext
context) {
super.appendToResponse(response, context);
response.setHeader("text/xml", "content-type");
}
}
on 10/3/05 03:35, Greg at email@hidden wrote:
You'll also want to override appendToResponse to set the content type
to text/xml
public void appendToResponse(WOResponse response, WOContext
context) {
super.appendToResponse(response, context);
response.setHeader("text/xml"), "content-type");
}
On 03/10/2005, at 7:42 PM, Blue Moon wrote:
You create a normal WOComponent, say MyComponent, but instead of
putting HTML in the MyComponent.html you put XML in it. Return this
component as result of the DirectAction call. That's all.
E.g.
MyComponent.html file content:
<?xml version="1.0" encoding="windows-1252"?>
<result>
<approvalcode><webobject name=approvalcode></webobject></
approvalcode>
<approvalmsg><webobject name=approvalmsg></webobject></
approvalmsg>
</result>
MyComponent.wod file content:
approvalcode: WOString {
value = nameOfMyApprovalCodeMethod;
}
approvalmsg: WOString {
value = nameOfMyApprovalMessageMethod;
}
Hope this helps.
Rudi Angela
On Oct 2, 2005, at 10:21 PM, WebObjects wrote:
Trying to establish the best solution to work with the following
scenario:
I have a vendor whose application needs to query our db. We have
established http as a transport standard, and I have open rights
to design whatever WO.app I want on the backend.
Ideally the 3rd party wants to submit a URL to our application,
for example something like http://mydomain.com/cgi-bin/WebObjects/
myapp.woa/wa/myaction?uid=joe?pwd=1234
and in return I’m to send back an XML document with elements like
‘approvalcode=1’, ‘approvalmsg=here is some text’.
What is the easiest way to return an XML doc?
Naturally I’ve poked around with the ‘Calculator’ example of
WebServices; but this may mandate that they design their
application to be a ‘consumer’ when all they may really want to do
is parse a resulting XML document w/out a lot of fuss.
Thanks for any guidance,
-Bill Reynolds
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40framedphotographics.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40framedphotographics.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden