Delphi 2005 Web Services Issue

I am having a problem accessing a web service through Delphi. I used Java WSDL with the WSDLimp version of 2007, and it looks like it created all the objects correctly. However, when I make a tester program that calls a service, each object is empty. If I delete the SOAPResponse object in the HTTPRIOAfterExecute method, I see that I returned a correctly formatted XML Soap package containing all the data that I would expect, but I can not access them through the objects. So is something missing?

+3
source share
4 answers

The response to the web service contains namespace aliases for each attribute. These aliases are not defined in the WSDL. For example, the WSDL contains the http://www.example.com/SomeService " namespace and request aliases that are on the fly like xmlns: ns3 =" http://www.example.com/SomeService "at the top level node. Thus , the attributes in the response look like ns3: somePropertyName = "[value]".

In the OPToSOAPDomConv block in TSOAPDomConv.InitObjectFromSOAP, he tries to find the attribute name without a namespace prefix. This causes the search to fail, and the property of the object remains empty. This happens even with 2007 source files.

The best fix I see is to modify the InitObjectFromSOAP procedure.

Around line 4181 add:

  RemTypeRegistry.InfoToURI(PropList[i].PropType^, NS, PropName, IsScalar);

AttrNode.HasAttribute, NS , :

  if AttrNode.HasAttribute(ExternalPropName, NS) then

, - SetObjectPropFromText. , Attr.Attributes [ExternalPropName]

SetObjectPropFromText(Instance, PropList[I], AttrNode.GetAttributeNS(ExternalPropName, NS))

, , NS, PropName IsScalar vars.

+1

Delphi - Delphi 7 Delphi 2007 ( 2006 ).

Delphi 2007, , Delphi 2005, SOAP.

http://cc.embarcadero.com/Item/24535

+1

I re-read the question and the fact that this Java web service made me remember something.

Make sure you are using the latest WSDLImp and SOAP devices. See the imported block to call RegisterInvokeOptions. The second parameter should be ioDocument. What happens if you change this to ioDefault.

I remember a post somewhere that suggested this for NetBeans Java Web Services (maybe?), But have not tried.

0
source

Source: https://habr.com/ru/post/1713776/


All Articles