Web Services in Objective-C
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 70 | |
Author | ||
License | CC Attribution 2.0 Belgium: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/39567 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
FOSDEM 200968 / 70
3
4
6
16
17
18
19
20
21
22
23
24
25
26
27
29
30
31
32
33
35
40
41
44
46
47
48
50
51
54
55
57
58
59
60
62
65
67
68
69
70
00:00
Extension (kinesiology)Network topologyElectric generatorMechanism designMessage passingUniform resource locatorKeyboard shortcutBitAbstractionVirtual machineLatent heatMereologyWeb serviceConnected spaceSoftware frameworkLibrary (computing)Codierung <Programmierung>InternetworkingMappingStandard deviationJava applet1 (number)QuicksortOperator (mathematics)Sheaf (mathematics)ImplementationBlock (periodic table)Web 2.0Order (biology)Substitute goodCommunications protocolText editorExpert systemSystem callForm (programming)Different (Kate Ryan album)Right angleProcess (computing)Product (business)INTEGRALObject (grammar)Template (C++)Line (geometry)Formal languageSelf-organizationElement (mathematics)CodeIntegrated development environmentSoftwareFreewareSinc functionNatural numberSubsetBasis <Mathematik>Direction (geometry)NeuroinformatikState of matterField (computer science)Metropolitan area networkView (database)Presentation of a groupInformationArithmetic meanCAN busVideo gameLecture/Conference
08:37
Context awarenessDialectOperator (mathematics)Mechanism designSlide ruleMultiplication signTerm (mathematics)Point (geometry)Extension (kinesiology)Object (grammar)Physical systemMereologyState of matterResonatorMessage passingData structureConnectivity (graph theory)Field (computer science)Video gameType theoryMathematicsThermal expansionSubsetElectronic mailing listElement (mathematics)Network topologySurjective functionCore dumpServer (computing)Real numberWeb serviceKeyboard shortcutFrame problemLevel (video gaming)Social classoutputFunction (mathematics)ChainSet (mathematics)Uniform resource locatorProcedural programmingRule of inferenceConnected spaceInstance (computer science)Content (media)ParsingMappingError messageStructural loadRight angleMaxima and minimaComputer fileQuicksortEmailInformationGroup actionImage registrationLecture/Conference
17:13
Codierung <Programmierung>Object (grammar)Category of beingExtension (kinesiology)Boolean algebraDependent and independent variablesTextsystemSoftwareElectronic mailing listData structureComplex (psychology)Key (cryptography)Arrow of timeInformationParameter (computer programming)Order (biology)CASE <Informatik>NamespaceMessage passingException handlingMultiplication signWeb serviceFile formatComputer configurationValidity (statistics)Group actionSerial portElement (mathematics)Representation (politics)Game controllerType theoryMereologyBitLevel (video gaming)Different (Kate Ryan album)Term (mathematics)EmailArithmetic meanString (computer science)Point (geometry)Endliche ModelltheorieBounded variationNatural numberSheaf (mathematics)MathematicsSeries (mathematics)SpacetimeMetropolitan area networkLecture/Conference
25:50
SoftwareObject (grammar)MereologyCategory of beingVideo gameWordDependent and independent variablesRight angleElectric generatorInsertion lossDataflowStandard deviationWeb serviceMultiplication signExtension (kinesiology)Roundness (object)Codierung <Programmierung>Physical systemDefault (computer science)InformationBitGroup actionEmailUniform resource locatorCode10 (number)Client (computing)Message passingWritingGame controllerCASE <Informatik>2 (number)Software bugWeb 2.0Self-organizationFirewall (computing)Goodness of fitInstance (computer science)Cartesian coordinate systemDirection (geometry)Mechanism designWindowString (computer science)Keyboard shortcutAutomationElement (mathematics)Social classParsingRevision controlIP addressTemplate (C++)Server (computing)Operator (mathematics)Latent heatLecture/Conference
34:27
Data centerSystems integratorIntegrated development environmentWeb serviceSpring (hydrology)Projective planeBootingCodierung <Programmierung>Dependent and independent variablesCartesian coordinate systemDatabasePhysical systemOrder (biology)Insertion lossSelf-organizationStandard deviationINTEGRALSocial classoutputInteractive televisionPasswordWindowExecution unitQuery languageSoftwareContext awarenessNumberCASE <Informatik>Fitness functionUniform resource locatorTrailSmoothingMessage passingWeb browserLoginC sharpFormal languageTable (information)Library (computing)Web 2.0Operator (mathematics)Open source.NET FrameworkJava appletCodeStructural loadProcess (computing)Electronic mailing listInformation securityComputer fileConnected spaceMachine visionRoundness (object)Multiplication sign1 (number)BitCore dumpStudent's t-testSampling (statistics)Division (mathematics)View (database)WritingVideo gameGroup actionMereologyStatement (computer science)Right angleLecture/Conference
42:18
Row (database)Dependent and independent variablesPoint (geometry)Table (information)CASE <Informatik>Multiplication signUniform resource locatorWeb serviceSet (mathematics)Connected spaceLoginPhysical systemComputer fileLaptopDifferent (Kate Ryan album)PasswordOnline helpStatement (computer science)Query languageData compressionValidity (statistics)LastteilungSystem administratorWeb applicationInformationLimit (category theory)Object (grammar)Element (mathematics)Software bugLevel (video gaming)Moment (mathematics)outputMathematicsClient (computing)Reading (process)Function (mathematics)Cartesian coordinate systemVideo projectorWordGoodness of fitPlastikkarteSemiconductor memoryInformation securityType theoryProcess (computing)SpacetimeNumberSoftware frameworkAuthenticationOpen setOffice suiteInterface (computing)Event horizonTheoryArithmetic meanWater vaporMedical imagingSampling (statistics)Metropolitan area networkMereologyComputer programmingView (database)SummierbarkeitLecture/Conference
50:04
SoftwareLatent heatPresentation of a groupCodierung <Programmierung>WindowPasswordQuiltIntegrated development environmentSoftware developerInstance (computer science)Order (biology)Cartesian coordinate systemRight angleParameter (computer programming)CodeType theoryInformationServer (computing)Pointer (computer programming)String (computer science)Group actionRow (database)Metropolitan area network1 (number)Graph coloringWhiteboardMultiplication signRevision controlAreaLimit (category theory)Machine visionLecture/ConferenceMeeting/Interview
54:35
Interactive televisionElement (mathematics)Connected spaceLoginMathematicsMereologyCategory of beingWeb serviceLecture/Conference
55:24
WikiInformationMatching (graph theory)Software developerConnected spaceMultiplication signSystem callPoint (geometry)Projective planeLecture/Conference
Transcript: English(auto-generated)
00:11
I was hoping to see a few more people for this one, because I thought it's not actually going to be specific. Right. I forgot to introduce myself last time. I'm Richard Fethnatt
00:22
Donald. I wrote the Web Services Library, which is still something in development, but it's actually used in production code, so it's reliable for what it does so far. Right. Let's start with Web Services. For anyone who doesn't know, what are Web Services?
00:45
Well, naively, they're any Web-based service, but there's a standard Web Services definition language, which is what you're really talking about when you say Web Services in any sort of corporate environment.
01:03
Web Services definition language is an XML language. It's used by large organizations to present APIs to let other people use their various services. We tend to use it
01:20
for talking to mobile phone operators. WSDL 1.1, the de facto standard, is, as far as I can tell, what everyone uses. WSDL 2.0 is the recommendation, the actual official standard, and is not completely different, but substantially different. With a different
01:44
structure, it's not compatible. What does it do? WSDL provides an abstract service definition for some sort of service you want to offer to other people, generally
02:03
via an Internet connection. It has bindings that map the abstract service definition to concrete data encodings and to specific URLs and protocols that you're going to use. It says HTTPS or HTTP or whatever you said, whereabouts the service is. The main target
02:28
of binding for WSDL is SOAP, which means that almost everyone maps the abstract service definitions to SOAP calls. In theory, you can use Web Forms. There's a mapping for
02:44
that. You can use XMLRPC. You can use any other mechanism you like. I don't know if there's an XMLRPC mapping that's standard. I haven't found it. Yeah, I should say I'm not claiming to be a great expert on Web Services. I think you have to be really
03:04
into standards bodies and defining things like that to actually get into it that much. The mapping in Web Services is done by extensibility elements, which are chunks of XML that sit inside other parts of the XML and say, like, this bit is going to be handled
03:25
by a particular extensibility mechanism. And all the different libraries and frameworks that support Web Services tend to support different subsets of the available extensibility elements, so they're all incompatible. Web Services, as I said, primarily uses SOAP,
03:47
Simple Object Access Protocol, which is a open block. It's one of the most complex protocols I've ever used. It's bloated. And you have to have software to move the management really. Either that, or you resort to just copying the XML documents and hacking
04:07
substitutions for sections of a template XML document. The main frameworks available are Java and C-sharp, so they're not much fun if you're an object of C-coder. And, as I said, the different implementations all support different incompatible options,
04:27
largely down to WSDL being designed that way. It's specified to be extensible. So I got into this because at work I had to integrate stuff with corporate Web Services.
04:42
I just couldn't find free software solutions to do the job in C or Objective-C. Java was readily available because there's stuff under the main Apache label, I think,
05:00
really. But using Java from other services is a painful, slow operation. You have to start up a virtual machine and run JMI calls to it. So we needed a free Objective-C or C solution. So you can use that Web Services library was written for better
05:26
performance if you get out of the Java stuff that I was looking at. And, of course, we target the most common WSDL setups, specifically the ones I needed to use, of course. But the idea is to make it easy to extend and make the framework more versatile,
05:48
a couple more options. So the library's written on Objective-C. It fills with the new step make or Apple Xcode. It's completely portable between the two. In fact,
06:09
it's just setting all the common standard bits. So it's the soap binding since that's what everyone uses. It can easily be extended to the others because it's designed
06:22
with the extensibility elements to be extensible. It makes it simple to write lines without having to use Java or C Java. So the way it works is to pass WSDL documents to produce a tree of objects, which can then be examined and
06:44
modified. You can also generate WSDL documents from a tree of objects, which leaves us the possibility of actually writing WSDL editors in future. In order to support that, we have a lightweight XML tree implementation there.
07:08
And the main operation that you actually end up doing, hopefully, is telling a GWSService object to perform a particular service, to talk to a service and perform an operation. We also provide an XML RPC tender. That's purely
07:26
because I think XML RPC is a far superior protocol. So if you can possibly do it, you should. So we've got synchronous and asynchronous
07:41
operations. There's no WSDL extensibility binding for XML RPC available yet. So it would be nice if someone would contribute that. They can write one in future. What that actually means is that you can't take a WSDL document and have it generate the XML RPC code
08:05
entirely for you. You've got to do a bit of it yourself. So it's not a big problem. If you don't need to use WSDL in SOAP, just use the XML RPC.
08:21
Of course, we provide SOAP in here. You can use it directly for SOAP requests. You don't have to use it as part of the web services structure. However, the GWSService understands the SOAP extensibility elements in the WSDL. And that allows you to know the service using
08:44
SOAP with a minimum of effort. You don't have to fill in details to tell it whether it's supposed to be using literal encoding or not. Because the WSDL will tell it that for you.
09:00
Right. So the top of the structure, the tree, is the GWSS document. That's initialized from a URL, generally, or maybe from a local file. LAP downloads or loads in the file, parses it, and creates an instance
09:21
of the GWSS document. That provides methods to examine the contents of the document and to modify them so you can edit. It also provides a mechanism to regenerate a WSDL document so you can post out a new version of it. Finally, it provides a registration mechanism for the handlers
09:42
to deal with WSDL extensibility. Within the document, you have various other objects. At the top level, the GWSS document. Inside, you have
10:01
GWS messages, which encapsulate the XML message element in the WSDL document. We've got the GWS port type, which encapsulates the port type from the XML bindings port service. So these are the major components that appear in a WSDL document
10:23
on that, onto objects that we hold in the tree. So the GWS message, which is the XML message, is the abstract idea of passing data between two endpoints.
10:43
So it just says, here's the server, here's the client, and we're passing this data between the two. It can contain documentation. So there's an element in there in the XML that can document what that message is supposed to be for
11:00
and it's supposed to be used. It will contain a list of named parts. Those are the actual data items that go to make up that particular message. The GWS port type represents a port type
11:20
which is a definition of an endpoint that you might be talking to. So it's the thing that's sitting on the end of a URL that you're going to connect to. Again, it can provide documentation.
11:41
It always provides a set of named operations. Those are effectively the procedure calls you can make to that endpoint. Each of those operations can consist of an input message, the data you send to it, an output message, the data that comes back to your client, and perhaps a fault message to indicate that there's some sort of error.
12:03
Again, that will come back to your client. GWS binding. Again, each of these bindings has a unique name, so you can refer to them easily within the document.
12:22
It can contain documentation, but most people don't. And it contains extensibility rules which basically tell you how to handle something, whether you're going to use SOAP or XMLRPC or whatever.
12:43
Each binding references a particular port type, so it's talking about how that port type is handled, how operations are sent to that port. And it lists the operations that you already had listed in the port type that this time, rather than just specifying what the operations are
13:01
in an abstract way, which is what the port type does, this gives you the extensibility element that tells you how those operations are actually managed, how the data is encoded. So, a port.
13:24
The concrete example of the endpoint. If the port type tells you what kind of endpoint you've got, the port tells you you have a particular port. It's on this particular URL. Therefore, given the port, it sends a message to it.
13:44
If you've got a SOAP extensibility, then in the GWS port, then that will tell you that the URL you've got to send to me is a particular URL, and it will tell you the SOAP action header to put in the HTTP request.
14:08
And I think almost finally, the GWS service is where all the other information actually comes together. So, a service represents, again,
14:21
the particular service element in the XML document, so you can have multiple services within a single document. Each one has a unique name, so you can find the service you want. Again, a service has documentation in the XML, though I've yet to see any real WSTL documents.
14:44
It has a list of all the ports we've got. So, the port, if you remember, contained the extensibility that told you the URL you actually had to connect to, and stuff like that, as well as referencing the abstract binding information, but it's all about the port type that is used.
15:02
All the huge chain of information that could be represented much more compactly, but that's the way WSTL works. So, the service lists all the ports that it can use, and the GWS service object handles invoking an operation on the service.
15:24
That's actually making a real concrete core to a real server at the other end, and getting the data back. So, that's what you really need to use, and you can use it without a GWS document. Normally, or I'm going to say normally, hopefully,
15:44
you pass a WSTL object into a GWS document, which creates all those other objects I've talked about behind the scenes, and you look at that GWS document for a particular service by name. Given that service object, you start invoking operations.
16:06
GWS element, another lightweight class, a small API, represents an XML element, but omits anything that you don't actually need for supporting web services.
16:20
It's used throughout the library, and lets us pass trees and un-pass trees to serialize and deserialize information. It's an intermediate stage when we're encoding server requests. Generally, you probably don't need to touch it.
16:42
That's the list of the main classes. So, we've got two important frames left. The extensibility elements and the coders. They don't map directly to anything in XML. The GWS extensibility is not a mapping from one of the XML extensibility elements.
17:02
It's actually an object that handles dealing with an extensibility element. So, you might have, or you do have, a GWS SOAP extensibility that provides for handling of SOAP extensibility elements, understands what they mean, basically,
17:21
and adjusts the way we deal with data. Similarly, the GWS coder in these subclasses handle the encoding and decoding of the data. So, they don't correspond to anything directly in the document, but they will convert from property list format, which is the way...
17:47
I won't say property list format. I'll say a structure of linked objects, a dictionary containing various other objects that describe the parameters you want to pass across to a remote service. They're the native internal object of C
18:02
representation of your parameters and service results. So, the coder takes those and it converts them into a SOAP request, an extensibility object. The way extensibility works
18:21
is that each extensibility object in the XML of the WSDL document has a namespace associated with it. So, what you do is you register a handler for that particular namespace, and when the document is passed, the handler for the namespace
18:41
receives callbacks from the GWSDL document, telling it about the extensibility items it's passing, and the handler can then check that those items make sense, check that it understands them. If it's got an extensibility item that it has to understand,
19:03
and yet it doesn't, it converts an exception. When a message is sent out by a service, we call the handler again for each of the extensibility elements defined for that service. And in that case,
19:20
the handler doesn't merely validate the XML and check that it understands it. It also takes actions on the basis of that. So, it would say, we know that the parameters actually have to be passed in a certain order. We'll define that order for the coder to pass.
19:43
We know that their sentence is literal, rather than useful. Different options for the SOAP. It will set in the coder. So, obviously, implementing that kind of thing is fairly complex, but we have an example in that we have a concrete SOAP coder,
20:02
SOAP extensibility. But the coders themselves encode property lists to NSData objects, decoding NSData to a property list. When I wrote that, I was assuming, I guess,
20:23
a GNU step or Apple audience. So, I think I may explain a little more in case the people here are not familiar with either. The term property list in CoCoM and in the new step is used to describe
20:40
quite complex data structures consisting of collections, arrays, and dictionaries, and strings, numbers, numbers, dates, booleans. We have a complex network of these objects as a property list.
21:02
So, a coder takes this complex network of objects, well, actually, it's usually fairly simple network of objects, generally just a list of parameters, and maybe they have some structure, but it serializes them. It's a semi-abstract class, which means it does some things,
21:21
but it doesn't do everything that's actually declared in its API. So, it has convenience methods for handling XML encoding, decoding, using GWSL elements. So, it can handle the serialization and deserialization for an XML document.
21:42
But it also has other methods for handling the delegation of encoding for specific items. And it has, as I said, the methods for decoding and encoding property lists, which are actually handled by a subclass.
22:03
Okay, so, a message is a dictionary, generally speaking. We add extra keys in our property list in that dictionary to tell the coder how to encode the data. So, we have a method key which specifies the method name that we're trying to invoke.
22:22
The parameters key gives you a dictionary with the parameters. The order key tells you what order those parameters have to be sent in. An arrow key and a response coming back tells you what the problem was.
22:41
The XML RPC encoder is a subclass of the coder, and it will take a property list and create an XML RPC request or a response. Similarly, it will decode any XML RPC document to a property list. That will actually handle
23:01
any valid XML RPC request because XML RPC is nice and simple. It supports setting the time set for encoding and decoding the date and time steps because that's about the only thing XML RPC doesn't really cover. It defines a format for date
23:20
that doesn't specify the time set so that has to be agreed between the two end points of the service. The SOAP coder adds yet more keys because SOAP is a whole lot more complex. Right, so there's the body encoding style which can be RPC
23:41
or document or wrapped. If you're not familiar with SOAP that's really telling you something about the general structure of the SOAP request that you've got a layout in your XML
24:01
with a different document format everything's kind of near the top level of the XML. If it's an RPC format then you've got an XML element to say what the method name is and all the parameters in another XML element a bit further down. So it's something you
24:20
generally don't want to bother with. Hopefully that information will come from the WSDL document so you can set it manually using that key or the WSDL document and fill it in for you. Similarly the use keys encoded or literal tells you something about
24:41
the way that data is encoded in the XML. Essentially encoded means that every element you pass along has to have type information with it. Literal means you pass the element with the data
25:01
and the other end works out what type it's supposed to be. The message header key lets you add header information which is another thing that SOAP has. The namespace URI and the namespace name key that you assign
25:21
URI and namespace name to your SOAP. And the SOAP value key is actually a special case that's not part of the SOAP stuff. So much as it lets you define a dictionary that has
25:41
extra information in it for you to get more control over how the SOAP stuff is encoded. I think it's pretty clear that trying to settle that manually for each SOAP request is tedious. If you have a WSDL document, it handles it all.
26:00
So when you invoke the operation, the service object calls the extensibility handler and that fills in all those values based on the extensibility information in the XML of the document. It'll even create a code for you.
26:24
Delegation. We use that a reasonable amount in this. It's a common practice in OpenStep APIs. So the delegate of a coder is an object that handles
26:42
certain operations for it. Or is informed of certain operations that may happen. Normally, we have a service as the delegate of the coder. If you want to, you can put your own delegate in there between the service and the coder. And it sets the messages
27:01
coming from the coder to the service. If you intercept those messages, you can override the encoding or decoding of any data right in your life. So you've got very fine control over what actually gets sent out to the other end. You can implement custom coding to deal with bugs
27:22
or other useful features in a service that you're talking to. The service delegates. Normally, a service has no delegate, but then you can set up your own delegate for a service. So you can be notified when it's completed
27:42
an RPC request. It's sent something to the other end. It's received something back. You can be notified when it's about to send something to the other end. And you can take the data that it's about to send and completely replace it with something else. Similarly, when a response comes back,
28:02
you can take the raw data coming from the other end, parse it your own way with something that's optimized for passing a particular service. The cert bindings contain the URL to be used for an operation. That's in the extensibility
28:23
of the port, if I remember correctly. Often, the URL is wrong. Almost always, the URL is wrong. That tends to be, I think, because what happens is you've got a big organization. They develop this. They set the URL that they're doing
28:41
their web service on, and then they expose this nice new web service to the rest of the world through a firewall that's using that to change the IP address. So the URL is then wrong. So, you have to override it. You can do that by setting
29:01
a delegate for the service. At the moment, when it's about to send the request to the other end, you tell it to use a different URL. Quite straightforward. You can change the same action header in the HTTP request at the same time.
29:22
Debugging. Well, you're going to have to do that. You can turn debugging on globally for the web services. That's by turning on a user default. And that will do a fair bit of logging and also generate extra information. You can also use a method on the
29:41
service to turn on debugging for that service, which will record all the XML sent and received. So you can see exactly what went out and try and figure out why the other end didn't like it. And that will also turn on debugging
30:01
in the code of that service to the users. You can also set it at the specific code level, if you just want to turn on or off logging for that code. Automization. That's a big issue, because using web services tends to be very slow.
30:24
It was really designed to try and make it faster, mostly because the main use I've had for it is sending SMS messages to mobile phones, which occasionally needs you to send out tens or possibly hundreds of messages a second.
30:45
You don't get hundreds of messages a second through a typical web service API no matter what you did, but you can get tens of messages. So the code is elegant method to let you override the encoding and decoding of the individual items.
31:01
That means that if you know that most of the items that you're going to be sending as part of your service request are actually fixed at constant, what you can do is capture them the first time they're generated and just reset the same one again and again so that you save the software the effort of having to generate
31:22
those items. Similarly, the service delegate method lets you override the encoding and decoding of the entire request. Now, probably you don't want to do that but on the odd occasion when performance really is the issue you can do that.
31:42
Again, you have the advantage of what the system will do is the first time round it will produce the XML that you need to send and you can then use that as a template for new versions of the XML when you send the next message.
32:01
The GWS element class has a strange method set literal value which allows you to basically set a string value for that element and that string will be used literally in the serialized XML resulting from it.
32:21
Again, that's the mechanism of stopping you having to generate the text from the document. You can just plug that in directly. It has to be used with caution obviously because if you set a literal value then it doesn't necessarily
32:40
represent valid XML. And the other thing that you can do is use a standalone service instance to avoid checking the WSDL. So, in that case you do have to fill in all those properties yourself.
33:03
Particular to avoid more overheads. So, what we've given you is something that lets you write Web Service Clients in Objective-C. It should let you write servers in Objective-C as well if you want but that's
33:21
largely untested because that's not what I use. Your code will run on CoCo run with NuStep on Linux, BSD, Windows and you can actually keep it simple by ignoring almost everything I've talked about. Which is probably
33:40
a good idea if possible. I think that's it. Ricardo is going to give you a concrete example of an application using your Web Fabulous Web Services.
34:35
So, what are we going to see now? It's an example
34:41
usage of these Web Services. So, incredibly we access salesforce.com which is a major on-demand CIM solution. It's a market leader essentially. It's not open source.
35:04
It's commercially used and very widely planned. What does it mean it's on-demand? They call it software as a service. So, you don't install anything. You get your browser login and walk from everywhere.
35:20
How do you access the data inside? So, if you have a CIM solution you need to integrate with legacy application with other systems because you need to essentially import and export data. In this case if you use a CIM for personal usage you have another smooth. Of course, it gets much more complex because
35:41
companies may have to track orders, opportunities, needs up to ticket cases and customer support. So, it can be tons of data but let's think about context because it is easy. It's not as possible. Since the application does not
36:00
assign you a data center you don't have access to the database. So, the only way you can get data in or out of Salesforce or competing solution everything which is on demand essentially follows the same philosophy is you need to pass through their mechanism.
36:20
So, they can give you tools and if these tools don't fit you you need to access the database using APIs. These APIs are exported as web services and here we have a connection. What's the problem? Salesforce.com supplies you with tools for example, for your contact list or
36:44
exporting, updating doing everything with your data. But, these are for Windows. So, you have a tool, but for example you can take a flat file, a CSV file, an XML file and just pump it up and load all your orders in
37:01
QuickTime or you can update them, delete them. If you need something more customized they provide you with a library for Java or C Sharp I believe it's .NET the majority of .NET users use C Sharp. So, with those
37:20
libraries you can write custom applications, you can do for example, web service or other third-party vendors that make big integration tools. For Objective-C no libraries opposite supply. I wonder I think if I call the customer service
37:42
Salesforce and tell you I have Objective-C I probably don't even know what it is. The web services are exported follow the SCORP standard so it's a complex, verbose and difficult thing which I've explained and the application we think about
38:01
I call it datapacing because you wash your hands with soap and you wash your data with soap explore the web services to encode soft requests and decode responses because at the end you speak to Salesforce with requests and they give you responses this is the most short
38:21
summary I can give you Requests will be familiar to anybody of you with a database so essentially you're doing queries instead of deletes updates there are other requests which are service requests so they actually invoke
38:42
operations in the application so they're not just accessing table data, but for example you can do a login which is the only database request listed here which is very important and there is a special
39:00
database request which is the upset which is essentially an update insert so what you typically need to do in a system integration is you have a bunch of orders with a unique ID and you pump them up in your system and you don't want to care if they exist or not. Usually
39:21
what you need to do is first to do an insert and then check what didn't get in and do an update, or the other way you do an update what didn't update, you get an error find and then you do an insert, but didn't get in this is the standard way and recently Salesforce implemented this upset method
39:41
I just put it in here as a node so what's a database in short? it's an application the open source hosted in the Gnustev application project and the goal is to provide a data loader replacement for the Gnustev environment the Spring is such a tool
40:00
many, many units the simple tool Salesforce provides for Windows why can't I have it on my machine? the nasty system is like a password for the API interaction class which is what I'm writing so I'm writing a class
40:20
which can talk to Salesforce having an input which can then be used to allow that because essentially it's a static tool if you want to have an integration application or you need to have a custom application you can use this class essentially I'm going to write what
40:40
Salesforce usually provides for other languages here I summarize the system how you talk to Salesforce this is Salesforce you send a request the request is for me a dictionary
41:00
so it can place some data it gets encoded by the web services the assault message and then you get the response the response gets decoded and you have an array with the data so ideally here you have an array with all your names and phone numbers this is plainly said
41:24
unfortunately things are not so easy because to a web service a URL everybody can query so you need security and everybody has a common manner to make security in the case of Salesforce
41:42
the whole login process is done in a complicated way I will explain it just because it means it's an example of what code is implemented you have a URL you make a request the login request and this is a common URL so everybody in the world will query that besides URL
42:01
even if Salesforce has like 20 data centers in the world everywhere you put this URL and you make a login where essentially you have your credentials username password and a security token because if you are within an organization your username and password are enough
42:20
if you are outside which is typically the case because you want to have a system on demand because you are abroad with your laptop you have a GPRS connection UNTS connection or you are a customer connecting you either need to free up your IP say this is a trusted IP
42:42
or you insert a token which is a token uniquely and it gets a set for each password change and it essentially acts as an additional password which means that your client is trusted once you send
43:01
these three identifying elements to Salesforce to essentially get back a session which means like in most web applications you have an ID for your session for that particular IP which is valid for a certain amount of time what is not written here
43:22
is that you get also back a URL point this URL point is where all your further requests will go and this is different each time because for load balancing system outages
43:40
for every reason each time you get one different and this is what for example discussed not always this URL is correct for example one byte I discovered is that if you do an you can do the whole process either using HTTP or secure HTTP both are possible of course secure
44:01
connection is fair because maybe you are sensing sensitive data but both are possible so you can query the first login the first then you can do it on the secure or on the non-secure URL the problem is that you should get a new URL which is consistent with what you
44:21
sent the first time you always get the secure one so if you don't support HTTPS essentially you are not going to send in the back so you need to rewrite the URL of some example then you have the session ID you keep for all subsequent requests you are going to do
44:40
in this case the example is just query so I am going to get some records and I pass a request in this case it's just something which is SQL they call it SQL it's an SQL, select, form, table and you pass a session ID which identifies you from that point on
45:01
in case you give back a response the records will query and you have some caveats because you get an array with types, column names you need to count that with these methods and there is also a limitation because you quit
45:20
querying 10,000 objects and you always get 255 records so this is for the record theoretically if you want to get more records there is a special query more which is like a query which continues where the previous query left I did not implement this yet
45:43
so this is in short what we did we sent the username, password and token we have a valid session ID we sent back the SQL-like statement the session ID and you receive a record array then you have something in memory and for the moment I brought it to the CSV file
46:00
because I have in that this time that because everyone has XML which is two verbose that file is a card even if a lot of system management likes it so my experience is that CSV is a good compromise between performance this is an example I want to try to connect
46:20
right now connecting this we might try a better time so here we see at the beginning the projector is of this quality here you see the login panel and here you see you just enter your query select the output file the interface is quite crude at the moment because
46:41
important things are underneath and here you see just the CSV file open office and we say we get back the column name, the type and the ID which is blank because I did not request it
47:00
quite easy and simple but the future for databasing well first I just implemented login and query because that was hard enough at the point because I did not use the WSPF but I called it all by hand
47:21
with his help but it wasn't finished it wasn't finished because when I started this the web services did not support swap yet each time I needed a new feature it had implemented it and I think we got the need because actually what we have here is a demonstration that the word system works
47:41
because other queries are not more complicated than login and query so the rest is just a long walk of typing and coding but the main walk is done then other features which the application itself needs is a better file input and output CSV, reading and writing it's a map that tries escaping
48:02
Unicode characters because whatever you have in your databasing I can speak of experience because I use several of these commercial tools and each one has its own bugs and quilts what I request from the Gnostic web services
48:21
is that at the moment the performance is sub-optimal because first if you do a lot of queries you can say I keep the URL connection open and just continue to query at the moment we close and open so this is called pipeline connections and this is more important
48:42
for you, for me which I have another problem I actually have that in Gnostic but not in CoCo so you need to figure out how CoCo if you have few queries which is what
49:01
you usually do with authentication but have a lot of data, the problem is data compression you can essentially zip up your verbose XML request because SOF ends up being very very verbose because you have all the type information all the space information each value is encoded
49:21
and has a type information attached to it and there are all the tags around it so you end up sending 10 kilobytes or maybe even send twice that amount of data all in plain ASCII text so Salesforce support and some web service framework support data compression I can admit I use
49:41
professional and expensive tools and they don't support it but the official Salesforce tools support it in the performance improvement especially with patterned data like contacts where everybody you have phone numbers different government files essentially that's it
50:01
we don't have more I could try to learn the application and see if we have network let's see this is an instance of Salesforce if somebody wants to test this application Salesforce gives you out a pre-developer environment
50:22
which has other features the only thing it limits you in the data you can develop everything but of course you can use it for your price
50:46
it's proven on NuStep and thanks to the latest efforts it already runs under Windows so this is very interesting show somebody here
51:03
have my credentials if not everybody has seen my password so I need to kill you well
51:29
we did not see the debug that was which I'm sure is very very well in the background we had like 2 kilobytes of debugging information which is very useful there is a lot of debugging
51:41
and then we can actually do it very for example once everything was done the concept is pretty simple
52:06
the fact is that between the specification of the WSPI and the document but you're actually yes
52:50
my demonstration is working it's working because actually as you can see the presentation is pretty much it's short because there is no rocket science behind it
53:01
the problem is that for example we discovered that many XML decoders on the server end are very sensitive so they are order sensitive you send your password and your username or your username and your password one works and the other one not this makes no sense for XML
53:21
but you discover it and you need for example to implement all the order coding just to get the parameters in the correct order and there are many other quilts like actions needing to be set to empty string instead of nil which is just debugging so
53:40
it's not awful that's it if anybody has questions the WSDL document is supposed to tell you all those things and usually it's right we now have the code to parse it and actually fill that all in which takes out all the effort of
54:00
having to remember it and read it yourself and add it in yourself I don't have the WSDL document here because I wanted to show the document is really really big so it contains specifications not for every period
54:20
but for every response and for every record it needs to specify the type so essentially it pops up everything do you have any documentation? yes you need to guess we went to get the login walk because login is the most difficult part because you have no interaction with the system
54:41
because after once you can get an ad-op so I just ended up snipping the HTTP connection so I had to make it to three so the WSDL documents for each element contain the documentation element which is supposed to make WSDL self-documenting
55:01
which will tell you how you're supposed to use the service the Salesforce one doesn't have any documentation no other WSDL has any documentation so it depends upon human beings to put that into the WSDL in reality
55:22
people don't change I tried to load the XML document but the connection is already open so if you have any questions the call check is free, available and it may be a good starting point
55:40
I could use until next time