Showing posts with label Documentation. Show all posts
Showing posts with label Documentation. Show all posts

2007/07/13

Copyright ®

Just for the record:

I always forget how to change the classic __My Company__ to my company's name... here is how!

In the file
~/Library/Preferences/com.apple.Xcode.plist
add the following property:
PBXCustomTemplateMacroDefinitions   Dictionary
ORGANIZATIONNAME String Business Applied C Objects

2006/11/04

Consuming Calculator.java WS

A well-known example, which is included in /Developer/ADC Reference Library/documentation/WebObjects/Web_Services/Web_Services.tar.gz, is a simple Calculator. To publish it is as simple as compile and run... however, to consume it inside Cocoa requires some extra knowledge; let us focus on the add method —the rest is completely analogous.

Once the service is running, the first step is to produce the "stubs"; this can be done using the command-line argument
Szamitogep# /Developer/Tools/WSMakeStubs
-x ObjC
-name Calculator
-url http://localhost:4210/WebObjects/
Calculator.woa/ws/Calculator?wsdl

which generates two objects: WSGeneratedObj.m and Calculator.m

Include these objects in a new Cocoa App project. Run Interface Builder by double-clicking the MainMenu.nib icon and, in the classes pane, create a new object, say CPO, with an NSForm *form outlet and an add: action. Create files, instantiate and connect. (of course I am supposing that you know how to do these =:o)

In the implementation of the -add: method, write the obvious line:
[[form cellAtIndex:2]
setDoubleValue:[[CalculatorService
add:[[form cellAtIndex:0] doubleValue]
in_addend2:[[form cellAtIndex:1] doubleValue]]
doubleValue]];

compile and run... you see?
It does not work!!

The problem is in the implementation of the -resultValue method of the object add:WSGeneratedObj (defined in Calculator.m, and generated by WSMakeStubs). If you change that implementation line from
return ... objectForKey: @"addReturn"];
to
return ... objectForKey: @"ns1:addReturn"];
it will work...

But, how to find out the correct key to use?

Simple... just before the return line of the -getResultDictionary method, inside WSGeneratedObj.m, add the line
NSLog(@"getResultDictionary>fResult = %@",fResult);
and bingo!

Finally, just for the record: I used this service to add 3.4 to 6.6... can you guess the result? Wrong! Sadly, my computer, a G4 Mac mini, does not know how to add... it brings as a result
9.999998099999999

2006/09/17

I am back...

I had been away trying to tame a PLC which call for me to remember how to code in binary... finally the beast surrender.

So, now I have again time to continue my experiments with Web Services. An e-friend from WOdev-list at apple (David LeBer) suggests the following lecture:
Consuming with WebServicesCore.framework
I will take a look and come back later!

2006/08/19

Web Services Documentation.

I found that the basic references to start to integrate WO's Web Service Provider with Cocoa Web Service Consumer are WebObjects Web Services and Cocoa Web Services, respectively. Both represent long readings, so I will have to be back later...

...some indications that this can be done are:

Jeremy's Little Corner...
iTod Hi-Fi