[Xml-compile] Timeouts for XML::Compile::WSDL

Mark Overmeer mark at overmeer.net
Thu Jan 28 22:51:40 GMT 2010


* Titi Ala'ilima (titi at leadkarma.com) [100128 19:46]:
> First off, there is a typo in the synopsis
> for XML::Compile::Transport::SOAPHTTP (http://kobesearch.cpan.org/htdocs/
> XML-Compile-SOAP/XML/Compile/Transport/SOAPHTTP.html):

I cannot find that page at all... seems that XML::Compile::SOAP is
not indexed.  As far as I can see, the change you made is already
in the current version.

> but quickly discovered that the default "address" is "http://localhost".
> I think no default and making it a required option might be better than
> a default that is far more often than not useless.

Well, it's a matter of taste.  Firstly, often the first attempts to run
the client is on the same system as the test server.  The other purpose
is to show the syntax. Either with default or without, many users will
get an error: whether it be "forgot required parameter" or "cannot
contact server at http://localhost" doesn't bother me much.

> Even better would be for the
> transport to not override the address that the $wsdl->compileClient used to be
> able to figure out for its own before I decided to override the timeout.

Either you provide your own user_agent object, and do everything yourself,
or you "do it on the cheap" where XML::Compile::SOAP picks some defaults
for you.  If you do not like my defaults, you can simply overrule them.
So, you have three options. Still not sufficient?

I think that providing your own LWP::UserAgent object to user_agent is
the best choice for your needs.

> Next I discovered that the "soapaction" header was no longer being set
> properly.
> The "action" option of $http->compileClient defaults to "", again a case of a
> useless default that would be better either not defaulting or defaulting in
> such a way that it wouldn't interfere with the operation if the transport
> weren't specified.

It's not a useless default. The soapAction header must be present, but the
content is not standard.  So, if the user does not specify it, I default it
to a blank, at least, get the header produced.

>     my $wsdl = XML::Compile::WSDL11->new($path);
>     my %index = %{$wsdl->index()};
>     my $wsdl_port = first {$_->{name} eq $port} @{(first {$_->{name} eq
>     $service} values %{$index{service}})->{wsdl_port}};
>     my $address = $wsdl_port->{soap_address}->{location};
>     my $wsdl_operation = first {$_->{name} eq $operation} @{$index{binding}->
>     {$wsdl_port->{binding}}->{wsdl_operation}};
>     my $action = $wsdl_operation->{soap_operation}->{soapAction};
>     my $http = XML::Compile::Transport::SOAPHTTP->new(timeout => $timeout,
>     address => $address);
>     my $transport = $http->compileClient(action => $action);
>     my $call = $wsdl->compileClient(operation => $operation, port => $port,
>     transport => $transport);

This is very far from the code you need to get it to work.  Far too
complex.  If you think that there is a bug with soapAction (which is
of course possible) then show me a small script which demonstrates it.
For instance, with an existing soap server.

> I haven't dug too deep into WSDL in the past, so I may not be doing things
> the best way, but hopefully this will save someone else some trouble.

No, above will cause a lot of problems for users. Close to all above
tricks have nice accessors which are readible and maintainable on the
long run.

So please go back to your original problem: you have a WSDL and try
to produce a message, but you do not see the soapAction in the message.
Small problem, which probably can be fixed in a line or two.
  . tell me which versions you use
  . show me your WSDL (can be off-list)
  . show me the message you expect to get.
-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list