WebObjects Web Casework Web Account Provider

 25 September 09:53    Web Objects supports Web Casework both as a ambassador and a consumer, and it infact works absolutely able-bodied already you amount out how to get things appropriately configured. Hopefully this walkthrough can jumpstart that action for you.

    = Ambience up a WO Web Casework Activity =

    Here are the basal accomplish for ambience up a Web Casework ambassador with WebObjects and Eclipse/WOLips:

    # Make a new WOApplication project

    # Adapt the projects Body Path, and go to the Libraries tab

    ## Add the afterward alien jars from /Library/WebObjects/Extensions.

    ############## Adapt the WO Frameworks accumulating and add the JavaWebServicesSupport framework from the Arrangement frameworks

    # Make a chic to authority your Web account methods. The methods do not charge to be changeless and can both yield circuitous types as ambit and acknowledgment circuitous types as acknowledgment values. For now, just acknowledgment archaic types and/or String.

    # Adapt your Appliance chic and add WOWebServiceRegistrar.registerWebService(PublishedNameOfYourWebService, NameOfTheClassYouJustMade.class, true);

    Thats it. Now if you alpha your app, you can appeal http://yourserver.com/cgi-bin/WebObjects/YourApp.woa/ws/PublishedNameOfYourWebService?wsdl and it will acknowledgment the autogenerated WSDL certificate that you can use with any amount of Web account audience to collaborate with your server.

    = Circuitous Types with WO Web Casework =

    So now the affair of circuitous types. Abiding circuitous types is fine, but you accept to annals the serializer and deserializer classes for anniversary circuitous blazon you reference. If you do not, the server will attack to serialize your item using the ArraySerializer (youll see this barring on the server), and the applicant will accuse about a cool absurdity with SYSTEMID (gotta adulation abhorrent absurdity handling!). The fix for this is for anniversary of your circuitous types, alarm the afterward adjustment in your Appliance constructor:

     WO Web ServiceRegistrar.registerFactoriesForClassWithQName(new BeanSerializerFactory(_class, _qName), new BeanDeserializerFactory(_class, _qName), _class, _qName);

    where _class is the Chic item that represents your circuitous type, and _qName is the QName (fully able name) of the chic as it appears in your WSDL document. For instance, if you created a circuitous acknowledgment blazon called Being and it is in the com.yourserver.service package, _class would be com.yourserver.service.Person.class and _qName would be new QName(http://service.yourserver.com, Person). Apprehension that the namespace is the changed of your amalgamation name. You will charge to alarm this adjustment for anniversary of the ambit and acknowledgment types your reference.

    For the record, I accept no abstraction why you accept to do this move manually -- The WSDL was autogenerated, and appropriately it KNOWS the classes and their QName WSDL mappings, but I was not able to get things to plan appropriately after this step. If anyone knows why this is, or a way about it, amuse amend this article.

    With these registrations, you should now be able to acquaint with WO using any accepted Web Account applicant (Axis, .NET, etc).

    = Sessions and WO Web Casework =

    You may accept noticed in your Web Account methods that you accept no WOContext, WORequest, WOSession, and accompany anesthetized in. Do not fret. The Web ServiceRequestHandler takes affliction to angle you up in this administration using Axiss MessageContext class. You can use the afterward cipher to get to your WOSession:

     WOContext ambience = (WOContext)MessageContext.getCurrentContext().getProperty(com.webobjects.appserver.WOContext);

     WOSession affair = context.session();

    or the shortcut

     WOSession affair = WO Web ServiceUtilities.currentWOContext().session();

    The afterward added keys are attainable through the MessageContext:

    = Arresting with Arbor in Java =

    If you are using Arbor to absorb a WO Web Service, be brash that there is an outstanding bug (open back about 2003, no less) that arbor by absence does not abutment casual added than one cookie to the server. WO sends both woinst AND wosid, so you lose your affair ID from the applicant on the acknowledgment cruise to the server. This can be anchored by applying the application from http://issues.apache.org/jira/browse/AXIS-1059 to your audience axis.jar. Arbor 1.1 has been archived at Apache, but you can download the antecedent from http://archive.apache.org/dist/ws/axis/1_1/ . The application does not altogether apply. There are two alone hunks, but it should be actual accessible how to fix the rejects (the application has two System.out.printlns that it claims were in the aboriginal antecedent that were not). Afterwards acclimation that, you can setStoreSessionIdInCookies(true) on your servers WOSession and setMaintainSessions(true) on your audience ServiceLocator and youll be acceptable to go.

    = Arresting with WebServicesCore.framework =

    There are several complications if it comes to using WebServicesCore with WebObjects, all of which axis from the WSMakeStubs generated code. Aloft using the cipher generated by WSMakeStubs, you will run into the afterward issues that charge to be anchored in its code:

    Apple provides a program alleged WSMakeStubs that is agnate to WSDL2Java in Axis, except that it sucks. It will, however, at atomic accord you a starting point for architecture your Web account applicant code, and with the changes categorical below, you can end up with appropriate applicant APIs.

    Running WSMakeStubs is actual simple:

    /Developer/Tools/WSMakeStubs -x ObjC -name NameOfServiceClass -url http://yourserver.com/cgi-bin/WebObjects/YourWOA.woa/ws/YourService?wsdl

    This will aftermath Objective-C cipher that you can use to alarm your Web service. As against to Axis, WSMakeStubs produces stateless cipher for your account (i.e. no affair tracking or cookie abutment -- alone changeless methods for anniversary adjustment of your Web service). All of the methods arise at the end of NameOfServiceClass.m that you will charge to call. WSMakeStubs aswell produces WSGeneratedObj.m, which contains the lower akin Web account amount calls.

    Another bug in WSMakeStubs is accompanying to methods that dont accept acknowledgment values. For abandoned methods, the methods are never infact Alleged by WSMakeStubs. If you attending at the cipher for the returnValue method, you will see that it never calls [super getResultDictionary]. The problem with this is that [super getResultDictionary] is the cipher that infact executes the Web account method. Artlessly change the analogue for your abandoned adjustment to be:

     - (id) resultValue

    And aggregate will plan as planned.

    WSGeneratedObj is MOSTLY bug free. However, there there are a brace changes appropriate to fix a anamnesis aperture it generates (from cocoadev.com):

    At the end of getResultDictionary, add:

     if (fRef) // new code

     acknowledgment fResult; // aboriginal code

    which now reveals that the NSURL that is acclimated is double-freed, fixable by removing one band from createInvocationRef:

     NSURL if (url Casual a Circuitous Blazon to WO Acknowledgment Ethics from WO Archetype Blazon Wrappers Accountability Administration Stateful Casework results)

     acknowledgment nil;

     CFHTTPMessageRef msgRef = (CFHTTPMessageRef)[results objectForKey: (id)kWSHTTPResponseMessage];

     NSDictionary [headers autorelease];

     //parse the cookies

     NSArray acknowledgment cookies;

     }

     - (void) setCookies:(NSArray

     - (int)timeoutValue

     - (void)setTimeout:(int)t

    You will charge to adapt -dealloc to absolution fCookies and fURLString. Beneath is my adapted adaptation getCreateInvocationRef. It is adapted to get the URL using the new accessor methods above, to get the adjustment name from the chic name (which makes a lot added faculty than hard-coding it to the chic name in every subclass), and to set the timeout. Afterwards that is a all-encompassing resultValues adjustment so that your generated subclasses can accept their -resultValues and -getCreateInvocationRef methods removed—the alone methods they crave are for ambience parameters. There is aswell a commented out band that you can uncomment to accept alter advice included in the after-effects dictionary. This is actual accessible if aggravating to alter the alteration of circuitous objects.

     - (WSMethodInvocationRef) genCreateInvocationRef

    

     acknowledgment invRef;

     }

     - (id) resultValue

    To use stateful services, alarm getReturnedCookies afterwards the first appeal and abundance the cookie dictionary. Then alarm setCookies: with that concordance on all of your consecutive Web casework calls. Depending on the accolade you use, you ability wish to save a new archetype of the accolade concordance afterwards anniversary request.

    

 


Tags: types, methods, service, services, calls, client, server, class, provider, person, complex, clients, results, actually, method, cookie, values, session, setting, generated

 service, class, return, complex, methods, services, webobjects, wsmakestubs, qname, method, types, session, server, wosession, client, following, yourserver, wocontext, cookies, dictionary, calls, generated, actually, getresultdictionary, results, apache, setting, parameters, values, request, person, messagecontext, cookie, clients, patch, , web service, web services, complex types, class qname, complex type, return values, yourserver com, web service client, com yourserver service, web service methods, service provider webobjects, web service provider,

Share WebObjects Web Casework Web Account Provider:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Permalink
Article In : Computers & Technology  -  Websites Help