Project 1 SOAP Extensions ---- 网页服务程序构件设计指要.docx
Project1SOAPExtensions-网页服务程序构件设计指要詹叔浩TheprojectrequiresapplicationdeveloperstoaddcreditcardpaymentfeatureintoanexistingretailsalessystemIbrachainstore.Stepbystep,thedocumenthighlightshow(odevelopapplicationofSOAPXM1.WebServicesandSOAPWebServices.AnddocumentwillissueimportantdetailsifyouworkonacomplexsystemwhichcontainsbothWebServicesandXM1.WebServices.KEYWORDS:WebServices.XM1.WebServices.SOAP.SOAPExtensions,SOAHeadersModelofClientandServerSOAPCommunicationClientSideReferringto(hefigureabove,wewilladdfeatureofprocessingSOAPmessagetothebelowexistingSOAPWebServiceswithoutSOAPEXIenS沁ns.Also,theSOAPmassageincludescostumercreditcardinfosuchascardnumber. ASynehronoUSCailIoaWebmethoddoesnotblockothercallingswhilethiscalliswaitingforaresult.Wheneverdevelopercreatesaproxyclassonclientside.NETautomaticallyenablesasynchronouscallstoWebmethods. SerializationprocessesSOAPmessageandconvertsoneormoremessageobjectstotheirXM1.reresentaUon. De-serializationprocessesSOAPmessageandconvertsoneormoremessageobjectstotheirbinaryrepresentation. SOAPRequestmeansaSOAPmessagesentfromclienttoserverforinvokingaWebInCIhod. SOAPResponsemeansaSOPmessagesentfromservertoclientwiththeresultsofaWebmethod.$1SolutionModelandAlgorithmReferringIothefigurebelow,(heblackdisksindicatewhereSOAPExtensionsperlb11n. TheXM1.WebServiceisnamed1.ookUpService. Theservice1.ookUpServiceexposesaWebmethodnamedRetrieveCardInfo. ThemethodRetiieveCaidInfotakescreditcardinfofromSQ1.serverdatabaseandreturnsit. Wecaptureandinspectandm<lifySOAPmessageinWebmethtxlRetrieveCardInfo.ModelofClientandServerSO.PCommunicationWITHSoAPExtensions$2ThreeMajorCodingSteps1. WecreateHTTPandSOAPXM1.webser,iceusing.NETFramework(selectingConsoleApplication).2. WederiveSOAPExtensionsCIaSSeSfromSoapExtensionbaseclass.Thus,theclassesexposeanditnplenenthefollowingmethods:*Getlnitialize(tobecalledonetimewhenasoapextensionisfirstloaded),*Initialize(tobecalledeachtimeforeachcallingSOAPwebservice);*ChainStream(forinterceptingactualsoapmessagestream),and*ProcessMessage(tobecalledwihactualrequestandresponse).3. WeinterceptaSOAPmessageandcallmethodEncrplMessageafterserializationstageandcallmethodDecryptMessagebeforedeserializationstage.$3TechnicalNotesWhydo¼rselectSQAPExtensionsratherthanS。APheaderSinthisproject?ThiSprojectrequiresonlycaptureandPrOCCdUreOfconfideniiaiSOAPmessagesinsteadofsecurityconcernssuchasauthentication(Ex:usernameandpasswordfor',log-in")andauthorization(Ex:applicationrole)andencryption(Ex.convertingtextlosecretcode). SOAPCX)CnSiOnSareaclassIobeinvokedduringtheserializationordeserializationofSOAPmessageandtoallowdevelopertoinsertcustomer-owncodeintoSOAPrequestandresponseprocessloop.SOAPextensionsareusuallydeployedinpairswithmatchinglheextensiononclientandserver. SOAPheadersareaclasslobederivedfromSoapHeaderbaseclassandrepresentlhedatainaparticularSOAPheader.SOAPheadershandleauthentication,encryption,andsigningdirectlyinSOAPmessages.$4WholePictureofVVebServicesandXM1.WebServicesShowingastheFigbelow,supposeanobjectofclientapplicationinteractswithoneobjectofanotherclientapplicationoverinternetandserverofwebservices.ReferringtotheSketchFigureonthelastpage,wediscussthetechnicaltermsbelow.(示意图) SOAP(SilnPlCObjectAccessProtocol)isastandardoencapsulatemessagesbetweenWebservicesSerVerandWebservicesclientwhenthemessageobjects(aswellasmethodsandproperties)aretransmittedasXM1.formatthroughHTTPchannel.Remember,messageobjectscannobeinvoked! DiscoisaMicrosoftstandardtodiscoverdocumentsofWebservicesonserverbydirectoryconnectingtotheserver. UDDI(UniversalDescription.Discovery,andIntegration)isamultivendorstandardtodiscovercodedetails(documents,classes,methods,andsoon)oftheWebservicesandotheronlinebusinesssericesbydirectoryvia(heInternet. VVSD1.(WebSerViCeDescription1.anguage)isastandardodescribetheinterfacebetweentheWebservicesandtheWebSerViCeSserver.InIact,WSD1.letdevelopertoretrieveinformationontheclassesandmethodssupportedbyaparticularWebservice. Disco.exeisa100lrelatedIoDiscotodiscoverdocumentsofWebSerViCeSonserver. VVsd1.exemaycreatePrOXyClaSSconnecedloWebReferenCeforcommunicatingwithXM1.Webservice.Also,aIQCalProxyCIUSSconnectedtoWebReferencemaybecreatedforcommunicatingwithWebservice.WhendowcselectthetechniquesWsdl.cxc?TherearebothofWebserviceandXM1.Webserviceintheexistinginternetsystem.Andadevelopermayaddnew-bothsendeestotheexistingsystem. SOAPProxyToolisused(otestanddebugWebservicewithoutexecutingWebserviceclientapplication. XW1.wireformatistheStnictureofactualXM1.passedbetweenWebservicesserverandWebSerViCeSclient.Byusingattributes,.NETallowsdevelopertotailorXM1.wireformatofSOAPmessageinordertointeroperatewithotherWebservicescomponentstonotbecreatedby.NETframeworkor.NETlanguage.(示意图)SketchFigureShowingArchitectureOfWebServiceandXM1.WebService(ContinuingtotheNextPage)ManulyCreateWsd1.exe.NETStudoAutoCfteDEVE1.OPERADDVVetSerVgCbertProduce1.essaaeTo1.ooiProxyClassOnlyforWebServicesNtffXM1.Wt>S*rvcsTestandDebugWebSrvcsWmUtExecutingClientApplication1.jVebReferenc.WebAppbotionObBSOAPHeadersSOAPExtensionsSOAPRequestSOAPRtpoSensIizabonDesenalizstcnMessageBsckServicesSOAPOsooUDDIWSD1.SOAPProxyToolWebSevresServerREMINDSBothwebservicesandass<iationswiththewebserviceslocateatwebserviceSERVERinsteadofclientcomputer.SOAP.Disco.UDD1.andWSD1.aregenerallynotblockedbyfirewallsbecausetheyaredesignedtouseHTTPastransmissionmechanism.TherearebothWebServicesandXM1.WebServicesintheSketchFigure.