Hi Jeff,

The first test you did failed because of a typo, I think. There is one slash too many.

Even with the correct file name you will need to modify the WSDL a little bit, I am afraid. I didn't look at it in detail, but it looks like the import statement is not processed correctly. 

You should put the content of vim.wsdl inside vimService.wsdl, at the location of the import statement. You have to exclude the top level <definitions> element from vim.wsdl, obviously, and you also have to declare the vim25 namespace. The first bit of the resulting WSDL should look like this:

<definitions targetNamespace="urn:vim25Service"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:interface="urn:vim25"
   xmlns:vim25="urn:vim25"
>
   <types>
      <schema
         targetNamespace="urn:vim25"
         xmlns="http://www.w3.org/2001/XMLSchema"

etc (over 42000 lines...).

I called the resulting file testVim.wsdl.

Then I did:

1>  TestWsdl = yaws_soap_lib:initModel("testVim.wsdl").
{wsdl,[{operation,"VimService","VimPort",
                  "CheckRelocate_Task","VimBinding",
                  "https://localhost/sdk/vimService","urn:vim25/4.0"},
       {operation,"VimService","VimPort","CheckMigrate_Task",
                  "VimBinding","https://localhost/sdk/vimService",
                  "urn:vim25/4.0"},
....

Next:

2> yaws_soap_lib:write_hrl(TestWsdl, "vim.hrl").
ok.

This creates a .hrl file with record declarations. It will be unavoidable to have a look at those, and the WSDL (or the documentation provided by vmware).

If you want to call the "CurrentTime" service, it will look like this:

3> yaws_soap_lib:call(TestWsdl, "CurrentTime", [{'p:CurrentTimeRequestType', [], {'p:ManagedObjectReference{[], "test", "test"}}], []).  
{error,conn_failed}

Good luck,
Willem

On Thu, Feb 4, 2010 at 4:33 AM, jm <jeffm@ghostgun.com> wrote:
Some foolhardy part of me decided that it would be a good idea to use
Erlang at work today to try and talk to the SOAP API that vmware uses. I
ran into some problems with using yaws and I'm hoping someone here may
be able to help. See,

http://www.vmware.com/support/developer/vc-sdk/

for information on VMware's Web Sevices SDK 4.0. Having installed
erlang, and yaws I tested it with the example at

  http://yaws.hyber.org/soap_intro.yaws

to make sure everything was functioning correctly before moving on. Next
I loaded the wsdl files provided as part of the SDK, after editing the
URL in the file to point to the correct location,

 > ServiceWsdl = yaws_soap_lib:initModel("file:///./vimService.wsdl").
** exception error: no match of right hand side value {error,enoent}
     in function  yaws_soap_lib:get_url_file/1
     in call from yaws_soap_lib:parseWsdls/5
     in call from yaws_soap_lib:initModel2/5

not so great. Try the other file,

WSDL = yaws_soap_lib:initModel("file://./SDK/wsdl/vim/vim.wsdl").
{wsdl,[],
      {model,[{type,'_document',sequence,
                    [{el,[{alt,'soap:Header','soap:Header',[],1,1,true,
                               undefined},
          .....

That's better. Now, try an operation,

 > yaws_soap_lib:call(WSDL, "CurrentTime", []).
{error,"operation not found"}

 > yaws_soap_lib:wsdl_operations(WSDL).
[]

This not looking good. For comparison, a similar operation on the WSDL
from the example gives,

 > yaws_soap_lib:wsdl_operations(WeatherWsdl).
[{operation,"WeatherForecast","WeatherForecastSoap",
            "GetWeatherByPlaceName","WeatherForecastSoap",
            "http://www.webservicex.net/WeatherForecast.asmx",
            "http://www.webservicex.net/GetWeatherByPlaceName"},
 {operation,"WeatherForecast","WeatherForecastSoap",
            "GetWeatherByZipCode","WeatherForecastSoap",
            "http://www.webservicex.net/WeatherForecast.asmx",
            "http://www.webservicex.net/GetWeatherByZipCode"}]


The file vimService.wsdl contains, with the server IP replaced with X.X.X.X,

<?xml version="1.0" encoding="UTF-8" ?>
<!--
   Copyright 2005-2007 VMware, Inc.  All rights reserved.
-->
<definitions targetNamespace="urn:vim2Service"
   xmlns="http://schemas.xmlsoap.org/wsdl/"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:interface="urn:vim2"
 >
<import location="vim.wsdl" namespace="urn:vim2" />
<service name="VimService">
<port binding="interface:VimBinding" name="VimPort">
<soap:address location="https://X.X.X.X/sdk/vimService" />
</port>
</service>
</definitions>

The file SDK/wsdl/vim25/vim.wsdl is much longer so I won't include it
here, but is available from the link to the sdk above (click on
downloads to right of the date under the title).

My questions, which  I hoping someone could help me with, are

1) Has anyone tried this before? Do you have some examples that I could use?
2) Is this WSDL file non-compliant? When I look at the file it has a
somewhat different structure to that in the yaws example.
3) Is there an alternate library which may understand this wsdl?
4) Is there an alternate angle/method of attack I should take to get
this working in erlang?
5) any other thoughts?

Jeff.





------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list