views:

200

answers:

3

I have to send the XML below. And i have no idea where to start. I know i need to look up SOAP in Perl but thats roughly it.

<xs:element name="CheckDomain"> 
<xs:complexType> 
<xs:sequence> 
<xs:element name="domain" type="domainRef"/> 
<xs:element name="suggestions" type="xs:boolean" default="false" minOccurs="0"/> 
</xs:sequence> 
</xs:complexType> 
</xs:element>
A: 

Well, you could get an HTTP client on CPAN, then just use a << (here documents) with (XML encoded values) interpolated variables to send the request. Then you would need to parse the response.

There should be a SOAP client for Perl, but that's not a combination I've encountered.

Interesting question, though. Good luck with the WSDL bludgeoning :-)

Roboprog
+4  A: 

Where to start? Start reading the documentation for SOAP::Lite; there are more expansive SOAP handling libraries here.

If you need more help, you may find what you need in some of the earlier questions on SOAP at Stackoverflow.

Ether
+1  A: 

The XML snippet you posted looks like XSD schema. It describes the following XML:

<CheckDomain xmlns="...">
 <domainRef>...</domainRef>
 <suggestions>true</suggestions> <!-- or it could be "false" -->
</CheckDomain>

The snippet you provided does not say what namespace CheckDomain needs to be, or what's supposed to be inside of domainRef. You need the whole XSD document for this.

Also, without seeing the WSDL file for the service, it's impossible to tell how to turn this into a valid SOAP message. (Assuming that you're dealing with a real SOAP service, and not just with a REST or XML-RPC service that happens to describe its input using XSD schema).

The beauty of SOAP is that you usually never have to do any of this manually. You just get the right tool and point it at the WSDL and XSD files published by the service, and you automatically have classes generated that do the right thing.

Eugene Osovetsky