R: SOAP, wsdl and connecting thru HTTP authentication

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

R: SOAP, wsdl and connecting thru HTTP authentication

Giorgio Ferraris

Hi, Tamara,

I was investigating some other SOAP services, and it seems that the problem of dictionary or struct is repeating.

Just for give you more info, here is an example of a SOAP call I have to do:

 

----start example from the service documentation ----

 

POST /XMLSelect/XMLSelect.asmx HTTP/1.1

 

Host: testws.galileo.com

 

Content-Type: text/xml; charset=utf-8

 

Content-Length: length

 

SOAPAction: "http://webservices.galileo.com/SubmitXml"

 

<?xml version="1.0" encoding="utf-8"?>

 

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

 

  <soap:Body>

 

    <SubmitXml xmlns="http://webservices.galileo.com">

 

      <Profile>string</Profile>

 

      <Request>xml</Request>

 

      <Filter>xml</Filter>

 

    </SubmitXml>

 

  </soap:Body>

 

</soap:Envelope>

 

----End example from the service documentation ----

 

And I have the following code to use, as suggested by the wizard:

 

client := XmlSelectSoapClient new.

 

arg1 := SubmitXml new

            profile: ("String");

            request: (Struct new

                  at: #any: put: "Object"

                  yourself );

            filter: (Struct new

                  at: #any: put: "Object"

                  yourself );

            yourself.

value := client submitXml: arg1.

 

I still have to implement at: ifAbsent: and checking for the call, if key is #Profile, answer self profile, if key is #Request answer self request, and so on (still not sure if it’s my job or the Wizard job).

But now there is the problem of the request and filter. Both are xml string, how can I pass it? Again I have the struct or dictionary not found error if I pass as .

 

If I look at the .NET case, I just have to add 2 XMLDocument (The Request and the Filter) as elements on the SOAP XMLRequest generated by the WSDL wizard in .NET.

Here it’s a bit obscure to me what should be “object” and #any for the 2 cases of request and filter.

Should I add some XMLDocument here too? Is #any to be substituted by #Request or #Filter?

 

This is probably due to my really shallow knowledge of SOAP, but with .NET I had no problems, and I’d like to have no problems on the VW side to (to be honest, I’d like to have less problem here in VisualWorks)

 

More on this on the Documentation thread on the VWDEV, I’m adding a message there.

 

Thanks for any help

 

Giorgio Ferraris

 

 

 

 

-----Messaggio originale-----
Da: Giorgio Ferraris [mailto:[hidden email]]
Inviato: martedì 15 agosto 2006 12.53
A: 'Kogan, Tamara'; 'vw-nc'
Oggetto: R: SOAP, wsdl and connecting thru HTTP authentication

 

Hi, Tamara,

 

Thanks for your answer.

I had already solved the problem of connecting to HTTPS and also the one of getting the certificate I needed for the connection, getting it from internet explorer (thanks to the documentation Martin and Edwards suggetsted). What I was looking for was exactly the " transportClient username: 'userID' password: 'password'" suggestion.

I was not able to found it on the docs.

Well, now the trip seems still long... because new problems are coming...

I had a bunch of classes generated by the wizard, and also the example transcript. Now, I took from the example a simple service:

 

client := XmlSelectSoapClient new.

client transportClient username: 'myuser' password: 'mypassword'

arg1 := GetIdentityInfo new

            profile: ('myprofilestring');

            yourself.

value := client getIdentityInfo: arg1.

 

When I execute the last instruction, I get an exception: "the object is not a Dictionary or a Struct type: aGetIdentityInfo"

 

The interesting thing is that the key of the needed dictionary is #Profile, so it seems like a wrong SOAP type.

 

I did a stupid trick, allowing GetIdentityInfo to answer to the message at:ifAbsent: , and I got back an answer of the supposed type, so I have passed both the certificate and the authorization step, and got an aswer!

I should still investigate if it's correct to have an empty answer to this service, but at least I passed all of the first step.

 

I know what I did is not correct, and not extensible to all of the more complex services.

Having used all of the automatically generated stuff, should not I have everything ready for execution on the first step?

 

XmlSelectSoapClient and GetIdentityInfo are classes generated by the WSDLWizard, as you can suppose, and the code, excluding the setting of credentials, is taken from the workspace generated by the wizard.

 

Thanks for any help. It seems that my first try to SOAP in VW need more time than supposed...

 

 

 

-----Messaggio originale-----

Da: Kogan, Tamara [mailto:[hidden email]]

Inviato: lunedì 14 agosto 2006 15.25

A: Giorgio Ferraris; vw-nc; [hidden email]

Cc: [hidden email]; [hidden email]

Oggetto: RE: SOAP, wsdl and connecting thru HTTP authentication

 

Hi Giorgio,

 

To use the Https you will need to have the port address in the wsdl

schema set as "https://....".

Change the soap address to https

<wsdl:port name="MyServiceSoap" binding="tns:MyServiceSoap">

<soap:address location="https://myservices.com/vvv"/>

</wsdl:port>

 

Reset the registries:

WsdlBinding reset.

 

Create a client

Client := MyWsdlClient new.

Client transportClient username: 'userID' password: 'password'. - will

set authentication data.

Client makeRequest. - the client will use https transport and

authentication for the request.

 

 

Tamara Kogan

Smalltalk development,

Cincom Systems

 

> -----Original Message-----

> From: Giorgio Ferraris [mailto:[hidden email]]

> Sent: Sunday, August 13, 2006 9:45 AM

> To: 'vw-nc'; [hidden email]

> Cc: [hidden email]; [hidden email]

> Subject: SOAP, wsdl and connecting thru HTTP authentication

>

> Hi,

>

> I have to send SOAP to a site via HTTPS, and there they have

> authentication,

> so I need to send my username and password to them.

>

> I had my sublclass of WSDLClient done by the WSDLWizard, and I'd like

to

> use

> it.

>

> There is a simple way of saying to the WSDLClient subclass instance

that

> it

> should send authentication when connecting via HTTPS?

>

> In using .NET, there is a simple way of doing it, building a

> NetworkCredential. There is some similar on VW (7.4.1)?

>

>

> Thanks for any help

>

> Giorgio Ferraris

>

>

>