Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
5
Erster Beitrag:
vor 1 Jahr, 2 Monaten
Letzter Beitrag:
vor 1 Jahr, 2 Monaten
Beteiligte Autoren:
Phil B, Peter Holemans, Danny Lauwers

[WD21] SOAP Webservice Help

Startbeitrag von Phil B am 08.09.2016 11:47

Hi Everyone

I am struggling with integrating a couple of web services and was wondering if anyone could offer some help or advice please?

I have imported my web service into Windev 21 and am able to make a call, and retrieve a result without any problems like so...

MyData is ExampleWebservice
MyResponse is ExampleWebserviceResponse

MyData.forename = "string"
MyData.surname = "string"
MyData.accountNumber = "123456"

MyResponse = ExampleWebservice(MyData)

This works fine, however the SOAP message that is sent using this method does not include a SOAP header. I need to include the following header in the sent SOAP message.

[soap:Header]
[UserAuthenticateHeader xmlns="https://www.example.co.uk/v3/";]
[UserName]string[/UserName]
[Password]string[/Password]
[/UserAuthenticateHeader]
[/soap:Header]

The only function I can find for this is SOAPAddHeader, but as far as I am aware this only works for other SOAP functions such as SOAPRunXML and will not work with the method described above. Does anyone know if this is possible for the above method? (The username & password can not be passed as a variable of MyData unfortunately.)

I am also able to use SOAPPrepare to create the XML, insert the header into the XML manually, then send using SOAPRunXML. My problem with this, is that SOAPPrepare seems to format the SOAP message using a different XML Schema than the webservice uses, which is incredibly annoying and basically gives me useless XML code. Is there any way of specifying the schema to use for this? Or if you have any other advice it would be much appreciated.

Thanks

Phil.

Antworten:

Hi Phil,

Did you try to set the authentification in code like this:
(Lists is an imported Microsoft SharePoint webservice)

//WS INIT Stuff
//Set Web service address and authentication
Lists..Address = pWSAddress
Lists..Authentication = auNegotiate
Lists..User = pWSUserName
Lists..Password = pWSUserPassword
Lists..MethodHTTP = httpPost
Lists..IgnoreError = httpIgnoreExpiredCertificate+httpIgnoreInvalidCertificate+httpIgnoreInvalidCertificateName+httpIgnoreRedirection


//DECLARE

SPLst is Lists.GetListItems
SPWSResponse is Lists.GetListItemsResponse

//SET PARAMS
SPLst.listName = "AP"

//EXECUTE WS
SPWSResponse = Lists.GetListItems(SPLst)

//Return Result
IF ErrorOccurred() THEN
RESULT (False, WSResponse)
ELSE
RESULT (True, WSResponse)
END


Cheers,

Peter

von Peter Holemans - am 09.09.2016 08:55
Thanks Peter

I have tried this, but I believe the username and password you are specifying there form part of the HTTP header, rather than the SOAP header like I need.

It looks like the only way to add a SOAP header is to manually add it into the SOAP XML message and then send via SOAPRunXML. I have got this working now, but have had to hard code my XML message because of the aforementioned problem with SOAPPrepare and the XML Schema's. Less than ideal, but functional.

Thanks Anyway

Phil.

von Phil B - am 09.09.2016 09:33
Hi Phil,

It is true that if you have to work via SOAPxxx to get your work done, WX becomes 10 times slower and more cumbersome than most other languages. If it works out of the box via the standard wsdl import, then you can really develop fast with WX but our experience is that for quiet a lot of web services this isn't the case. In our case it are mostly Microsoft or Oracle web services that come with standard solutions like SharePoint or any of the Oracle ERP packages.

We have a similar ticket open with PCSoft on applying an 'inner xml' to a web service string parameter (Microsoft style web services) (See also here).

It is with PCSoft development for further investigation of our request for information and a suggestion on how to easily implement it in WX by giving the possibility of an ..InnerXML attribute to the parameter aside of the ..Value attribute.

Although WX shines in many aspects, in this specific case, the development in C# to consume these standard Microsoft web services would easily be 10 times faster than with WX using the SOAPxxx commands, not even talking about maintaining the massive custom coding required to manage the xml flows 'by hand' later on in WX.

We're awaiting a final confirmation from support on a potential workaround or solution before we will propose to deliver this large project with Visual Studio to our multinational customer instead of WX or not. In general, we deliver all our projects with source code included (IP remains with us of course) so our customers have to buy our development platforms used as well if they want to customise it. This means PCSoft looses sales as well if we choose another platform for a solution.

On the french WinDev PCSoft forum you can find similar complaints/questions on the consumption of these Microsoft web services dating back to 2012 and earlier so it is nothing new it seems...

Just my 2 cents,

Peter Holemans

von Peter Holemans - am 09.09.2016 11:46
Hi,

Sometimes we use a proxy service written in C# to communicate between different development platforms. The C# handles the SOAP or specific Microsoft technology and exposes a REST API or MQTT. Then the other language/platform/... is using this wrapper.

You could also write a .NET DLL that handles the specifiek SOAP request and use that in WX.

Of course this is extra overhead in programming and maintenance. But it depends if you what your main development done in WX or not.

Danny

von Danny Lauwers - am 12.09.2016 08:07
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.