this is my first post so I am sorry if I make something messier...
I am trying to create a new API Method in Magento 1.8 in order to allow simple products to be assigned to bundle products. I followed some different guides but each example gives me the same error:
SoapFault Object
(
[message:protected] => Function ("blinkAssign") is not a valid method for this service
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => C:\wamp\www\customer\sincro\test.php
[line:protected] => 27
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => C:\wamp\www\customer\sincro\test.php
[line] => 27
[function] => __call
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => blinkAssign
[1] => Array
(
[0] => stdClass Object
(
[sessionId] => fe0b90725878bf1e8fac34ebf7a64137
[message] => test
)
)
)
)
[1] => Array
(
[file] => C:\wamp\www\customer\sincro\test.php
[line] => 27
[function] => blinkAssign
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => stdClass Object
(
[sessionId] => fe0b90725878bf1e8fac34ebf7a64137
[message] => test
)
)
)
)
[previous:Exception:private] =>
[faultstring] => Function ("blinkAssign") is not a valid method for this service
[faultcode] => Client
[faultcodens] => http://schemas.xmlsoap.org/soap/envelope/
)
And these are my files:
/Interdigital/Bundleapi/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Interdigital_Bundleapi>
<version>0.1.0</version>
</Interdigital_Bundleapi>
</modules>
<global>
<helpers>
<bundleapi>
<class>Interdigital_Bundleapi_Helper</class>
</bundleapi>
</helpers>
<models>
<bundleapi>
<class>Interdigital_Bundleapi_Model</class>
</bundleapi>
</models>
</global>
</config>
/Interdigital/Bundleapi/etc/api.xml
<?xml version="1.0"?>
<config>
<api>
<resources>
<bundleapi_blink translate="title" module="bundleapi">
<title>Bundleapi</title>
<model>bundleapi/blink_api</model>
<acl>bundleapi/blink</acl>
<methods>
<assign translate="title" module="bundleapi">
<title>Assign</title>
<acl>bundleapi/blink/assign</acl>
</assign>
</methods>
</bundleapi_blink>
</resources>
<resources_alias>
<blink>bundleapi_blink</blink>
</resources_alias>
<v2>
<resources_function_prefix>
<blink>blink</blink>
</resources_function_prefix>
</v2>
<acl>
<resources>
<bundleapi translate="title" module="bundleapi">
<title>Bundleapi</title>
<sort_order>1</sort_order>
<blink translate="title" module="bundleapi">
<title>Blink</title>
<sort_order>2000</sort_order>
<assign translate="title" module="bundleapi">
<title>Assign</title>
</assign>
</blink>
</bundleapi>
</resources>
</acl>
</api>
</config>
/Interdigital/Bundleapi/etc/wsdl.xml
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
</schema>
</types>
<message name="blinkAssignRequest">
<part name="sessionId" type="xsd:string"/>
<part name="message" type="xsd:string" />
</message>
<message name="blinkAssignResponse">
<part name="result" type="xsd:string" />
</message>
<portType name="{{var wsdl.handler}}PortType">
<operation name="blinkAssign">
<documentation>this is an example of api method...</documentation>
<input message="typens:blinkAssignRequest" />
<output message="typens:blinkAssignResponse" />
</operation>
</portType>
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="blinkAssign">
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
<input>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="{{var wsdl.name}}Service">
<port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
<soap:address location="{{var wsdl.url}}" />
</port>
</service>
</definitions>
/Interdigital/Bundleapi/Model/Blink/Api.php
<?php
class Interdigital_Bundleapi_Model_Blink_Api extends Mage_Api_Model_Resource_Abstract
{
public function assign($message)
{
return "This is the message: ".$message;
}
}
/Interdigital/Bundleapi/Model/Blink/Api/V2.php
<?php
class Interdigital_Bundleapi_Model_Blink_Api_V2 extends Interdigital_Bundleapi_Model_Blink_Api
{
//empty
}
I also have the wsi.xml file inside /etc but it is the same as the wsdl.xml one but adding the wsdl: to the tags...
I am making the call like this:
$proxy = new SoapClient('http://local.domain/api/v2_soap/?wsdl');
$sessionId = $proxy->login((object)array('username' => 'interdigital', 'apiKey' => 'pruebaeltaller'));
try{
$resultretun = $proxy->blinkAssign((object)array('sessionId' => $sessionId->result, 'message' => 'test'));
}catch(SoapFault $e){
echo "<pre>";print_r($e);echo "</pre>";
}
print_r($resultretun);
$proxy->endSession((object)array('sessionId' => $sessionId->result));
I would appreciate any kind of help, because that's making me crazy... Thanks!
Solution by OP.
I found the problem... it was with the wsi.xml file so I am pasting the one working here:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}"
targetNamespace="urn:{{var wsdl.name}}">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
<xsd:element name="blinkAssignRequestParam">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string" />
<xsd:element minOccurs="1" maxOccurs="1" name="message" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="blinkAssignResponseParam">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="result" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="blinkAssignRequest">
<wsdl:part name="parameters" type="typens:blinkAssignRequestParam"/>
</wsdl:message>
<wsdl:message name="blinkAssignResponse">
<wsdl:part name="parameters" type="typens:blinkAssignResponseParam" />
</wsdl:message>
<wsdl:portType name="{{var wsdl.handler}}PortType">
<wsdl:operation name="blinkAssign">
<wsdl:documentation>API method assign products to bundle</wsdl:documentation>
<wsdl:input message="typens:blinkAssignRequest" />
<wsdl:output message="typens:blinkAssignResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="blinkAssign">
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="{{var wsdl.name}}Service">
<wsdl:port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
<soap:address location="{{var wsdl.url}}" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Related
I am trying to (re)generate code again from a preexisting WSDL. I am not able to use wsimport as it is giving binding failed error. So I tried WSDL validator from CXF. It gives this error. Please see below for my WSDL.
WSDLValidator Error :
Summary: Failures: 1, Warnings: 0
<<< ERROR!
Part <scheduledJob> in Message <{http://webservices.jobs.batch.prompt.com/}ImmJobWSIF_getScheduledJobResponse> referenced Type <{http://webservices.jobs.batch.prompt.com/}ScheduledJob> can not be found in the schemas
Here is the WSDL. Inline schema looks good comparing to some online schemas. I have no clue.
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="ImmJobWS"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://webservices.jobs.batch.prompt.com/"
xmlns:tns="http://webservices.jobs.batch.prompt.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<types>
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://webservices.jobs.batch.prompt.com/"
xmlns="http://webservices.jobs.batch.prompt.com/">
<xsd:element name="ScheduledJob">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="jobId" type="xsd:int"/>
<xsd:element name="jobName" type="xsd:string"/>
<xsd:element name="jobCategoryName" type="xsd:string"/>
<xsd:element name="jobClassName" type="xsd:string"/>
<xsd:element name="jobStatus" type="xsd:string"/>
<xsd:element name="nextExecutionDate" type="xsd:dateTime"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="ImmJobWSIF_getScheduledJob">
<part name="job_id" type="xsd:int"/>
<part name="user_ident" type="xsd:string"/>
</message>
<message name="ImmJobWSIF_getScheduledJobResponse">
<part name="scheduledJob" type="tns:ScheduledJob"/>
</message>
<message name="ImmJobWSIF_startSched">
<part name="user_ident" type="xsd:string"/>
</message>
<message name="ImmJobWSIF_startSchedResponse">
<part name="result" type="xsd:string"/>
</message>
<message name="ImmJobWSIF_stopSched">
<part name="user_ident" type="xsd:string"/>
</message>
<message name="ImmJobWSIF_stopSchedResponse">
<part name="result" type="xsd:string"/>
</message>
<portType name="ImmJobWSIF">
<operation name="getScheduledJob" parameterOrder="job_id user_ident">
<input message="tns:ImmJobWSIF_getScheduledJob"/>
<output message="tns:ImmJobWSIF_getScheduledJobResponse"/>
</operation>
<operation name="startSched" parameterOrder="user_ident">
<input message="tns:ImmJobWSIF_startSched"/>
<output message="tns:ImmJobWSIF_startSchedResponse"/>
</operation>
<operation name="stopSched" parameterOrder="user_ident">
<input message="tns:ImmJobWSIF_stopSched"/>
<output message="tns:ImmJobWSIF_stopSchedResponse"/>
</operation>
</portType>
<binding name="ImmJobWSIFBinding" type="tns:ImmJobWSIF">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc" />
<operation name="getScheduledJob">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</input>
<output>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</output>
</operation>
<operation name="startSched">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</input>
<output>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</output>
</operation>
<operation name="stopSched">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</input>
<output>
<soap:body use="literal" namespace="http://webservices.jobs.batch.prompt.com/" />
</output>
</operation>
</binding>
<service name="ImmJobWS">
<port name="ImmJobWSIFPort" binding="tns:ImmJobWSIFBinding">
<soap:address location="http://vm-prover.maleri.com:8782/projImmJobs/ImmJobWS"/>
</port>
</service>
</definitions>
Setting up a webservice on my Symfony server, I follow this guide:
https://symfony.com/doc/current/controller/soap_web_service.html
Example given is working well, with this hello fonction:
public function hello($name)
{
return 'Hello, '.$name;
}
So I've tried to complete this webservice with this bye function:
public function bye($name)
{
return 'Goodbye, '.$name;
}
And here is my wsdl:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:arnleadservicewsdl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:helloservicewsdl">
<types>
<xsd:schema targetNamespace="urn:hellowsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</types>
<message name="helloRequest">
<part name="name" type="xsd:string" />
</message>
<message name="helloResponse">
<part name="return" type="xsd:string" />
</message>
<message name="byeRequest">
<part name="name" type="xsd:string" />
</message>
<message name="byeResponse">
<part name="return" type="xsd:string" />
</message>
<portType name="hellowsdlPortType">
<operation name="hello">
<documentation>Hello World</documentation>
<input message="tns:helloRequest"/>
<output message="tns:helloResponse"/>
</operation>
<operation name="bye">
<documentation>Goodbye World</documentation>
<input message="tns:byeRequest"/>
<output message="tns:byeResponse"/>
</operation>
</portType>
<binding name="hellowsdlBinding" type="tns:hellowsdlPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="hello">
<soap:operation soapAction="urn:arnleadservicewsdl#hello" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="bye">
<soap:operation soapAction="urn:arnleadservicewsdl#bye" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:hellowsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="hellowsdl">
<port name="hellowsdlPort" binding="tns:hellowsdlBinding">
<soap:address location="http://10.0.0.42/esi/soap" />
</port>
</service>
</definitions>
Hello function is still working, but each time i call bye function, I get an error:
Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML
Where am I wrong?
Ok, first I have rewritten my WSDL with help of https://www.wsdl-analyzer.com/. Here is my new WSDL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<wsdl:definitions name="helloServiceController"
targetNamespace="urn:helloServiceControllerwsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:helloServiceControllerwsdl">
<wsdl:types>
<xsd:schema targetNamespace="urn:helloServiceControllerwsdl">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="helloRequest">
<wsdl:part name="name" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="helloResponse">
<wsdl:part name="return" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="byeRequest">
<wsdl:part name="name" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="byeResponse">
<wsdl:part name="return" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="helloServicePortType">
<wsdl:operation name="hello">
<wsdl:documentation>Hello World</wsdl:documentation>
<wsdl:input message="tns:helloRequest"/>
<wsdl:output message="tns:helloResponse"/>
</wsdl:operation>
<wsdl:operation name="bye">
<wsdl:documentation>Bye World</wsdl:documentation>
<wsdl:input message="tns:byeRequest"/>
<wsdl:output message="tns:byeResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="helloServiceBinding" type="tns:helloServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<soap:operation soapAction="urn:helloServiceControllerwsdl#hello" style="rpc"/>
<wsdl:input>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="bye">
<soap:operation soapAction="urn:helloServiceControllerwsdl#bye" style="rpc"/>
<wsdl:input>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="encoded" namespace="urn:helloServiceControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="helloService">
<wsdl:port name="helloServicePort" binding="tns:helloServiceBinding">
<soap:address location="http://10.0.0.42/esi/soap"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
After that, it was still not working and even hello function was not working. After pulling my hair for a while, I simply restarted my server and it was good. Probably a cache problem!
My problem is that I have these two files:
1.- marcas.psgi
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Curl::easy;
use WWW::Curl;
use Data::Dumper qw(Dumper);
$Data::Dumper::Sortkeys = 1;
use Plack::Request;
my $app = sub {
### Pasandole los valores desde el $env
my $env = shift;
my $request = Plack::Request->new($env);
my $MARCA1 = "";
my $MARCA2 = "";
my $MARCA3 = "";
my $MARCA4 = "";
my $MARCA5 = "";
if ($request->param('MARCA1')) {
$MARCA1 = $request->param('MARCA1');
}
if ($request->param('MARCA2')) {
$MARCA2 = $request->param('MARCA2');
}
if ($request->param('MARCA3')) {
$MARCA3 = $request->param('MARCA3');
}
if ($request->param('MARCA4')) {
$MARCA4 = $request->param('MARCA4');
}
if ($request->param('MARCA5')) {
$MARCA5 = $request->param('MARCA5');
}
#print system('php','-r','echo "Hola\n";');
my $resultado = `php -r '
include_once "marcas.php";
prueba_curl("$MARCA1","$MARCA2","$MARCA3");
'
`;
#print $resultado;
return [
'200',
[ 'Content-Type' => 'text/plain' ],
[ "<h1>".time()."</h1><br><br>".
"MARCA1: ".$MARCA1."<br>".
"MARCA2: ".$MARCA2."<br>".
"MARCA3: ".$MARCA3."<br><hr><br>".
$resultado."<br><hr><br>" ],
];
}
2.- IFSoft.wsdl
<?xml version="1.0" encoding="iso-8859-1" ?>
<wsdl:definitions name="IFSoft"
targetNamespace="http://ip:5000/cgi-bin/psgi/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://ip:5000/cgi-bin/psgi/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<wsdl:types>
<xsd:schema elementFormDefault="qualified"
targetNamespace="http://ip:5000/cgi-bin/psgi/wsdl" >
<xsd:element name="marcasConsulta">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="MARCA1" type="xsd:string" />
<xsd:element name="MARCA2" type="xsd:string" />
<xsd:element name="MARCA3" type="xsd:string" />
<xsd:element name="MARCA4" type="xsd:string" />
<xsd:element name="MARCA5" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="marcasRespuesta">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="TablaMarcas" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="marcasIn">
<wsdl:part element="tns:marcasConsulta" name="parameters" />
</wsdl:message>
<wsdl:message name="marcasOut">
<wsdl:part element="tns:marcasRespuesta" name="parameters" />
</wsdl:message>
<wsdl:portType name="IMarcas" >
<wsdl:operation name="ConsultaMarcas" parameterOrder="MARCA1 MARCA2 MARCA3 MARCA4 MARCA5" >
<wsdl:input message="tns:marcasIn" name="marcasIn" />
<wsdl:input message="tns:marcasOut" name="marcasOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="IMarcas" type="tns:IMarcas">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="ConsultaMarcas">
<soap:operation soapAction="marcasIn" style="document" />
<wsdl:input name="marcasIn" >
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="marcasOut" >
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ConsultaMarcas">
<wsdl:documentation>Consulta de Marcas IF-Software.</wsdl:documentation>
<wsdl:port binding="tns:IMarcas" name="IMarcas" >
<soap:Address location="http://ip:5000/cgi-bin/psgi/marcas.psgi" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
To run the marcas.psgi what I do is:
plackup marcas.psgi
How I can do to access that marcas.psgi through the WSDL? How "public" that WSDL?
Thank you very much for everything.
I have this wsdl
<definitions targetNamespace="http://testwork/" name="HelloWorldService"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://testwork/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema>
<xsd:import namespace="http://soapServlet/" schemaLocation="http://localhost:8085/testwork/soapServlet?xsd=1"/>
</xsd:schema>
</types>
<message name="sayHelloWorldFrom">
<part name="parameters" element="tns:sayHelloWorldFrom"/>
</message>
<message name="sayHelloWorldFromResponse">
<part name="parameters" element="tns:sayHelloWorldFromResponse"/>
</message>
<message name="additionalFault">
<wsdl:part name="error" element="tns:responseFault"/>
</message>
<portType name="HelloWorld">
<operation name="sayHelloWorldFrom">
<input wsam:Action="http://testwork/HelloWorld/sayHelloWorldFromRequest" message="tns:sayHelloWorldFrom"/>
<output wsam:Action="http://testwork/HelloWorld/sayHelloWorldFromResponse" message="tns:sayHelloWorldFromResponse"/>
<wsdl:fault name="error" message="additionalFault"/>
</operation>
</portType>
<binding name="HelloWorldPortBinding" type="tns:HelloWorld">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHelloWorldFrom">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="error">
<soap:fault name="error" use="literal"/>
</fault>
</operation>
</binding>
<service name="HelloWorldService">
<port name="HelloWorldPort" binding="tns:HelloWorldPortBinding">
<soap:address location="http://localhost:8085/testwork/soapServlet"/>
</port>
</service>
</definitions>
I want to check if this element "sayHelloWorldFrom" really exists in this schema. I use XPath for searching, this is my snippet of code
InputStream isr = IOUtils.toInputStream(wsdl);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(false);
try {
org.w3c.dom.Document doc = factory.newDocumentBuilder().parse(isr);
XPathFactory xFactory = XPathFactory.newInstance();
XPath xPath = xFactory.newXPath();
org.w3c.dom.Element element = (org.w3c.dom.Element) xPath.compile(
"definitions/portType/operation[#name='" + funcName +
"']").evaluate(doc, XPathConstants.NODE);
log.info("element " + element);
if (element == null) {
throw new ServiceException(ErrorCode.SOAP_EXCEPTION_005);
}
But the element == null for some reason, but I saw via debug that funcName is really sayHelloWorldFrom. Thus what is the problem?
I don't know why, but when I removed this part:
xmlns="http://schemas.xmlsoap.org/wsdl/"
xpath worked (maybe because xmlns means something for xml or xpath)
definitions/portType/operation[#name='sayHelloWorldFrom']
you can check it here http://www.xpathtester.com/obj/2403e210-fac4-4dd2-be63-69fcba8e0ac1
Update: This issue has been resolved. I was trying to authenticate various admin accounts which apparently are in a separate database than the user accounts this service talks to. I used a generic user account that I created in CISCO and the web service calls worked great!
I would like to thank #Yahia for the recommendation on running Fiddler also!
I've been reading over the CICCO UCP Web Service documentation for days now. I'm able to talk to the one web service on the box, with proper credentials and everything works fine; however, with the UCP Service, I get an error... SoapUI seems to understand the WSDL file, and I'm able to send a request to the endpoint but I get an authentication error, below.
I use the same username and password to login to the ACS Portal so the account is not expired. I'm pretty much lost on this one and at the mercy of CICSO tech support. Any and all ideas are welcome!
SOAP Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:authenticateUserResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://cisco.com/nm/acs/mgmt/ucp/service/">
<authenticateUserReturn href="#id0"/>
</ns1:authenticateUserResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:ResponseType" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://cisco.com/nm/acs/mgmt/ucp/service/">
<errors soapenc:arrayType="xsd:string[1]" xsi:type="soapenc:Array">
<errors xsi:type="xsd:string">Credentials are incorrect.</errors>
</errors>
<status href="#id1"/>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:StatusCodeType" xmlns:ns3="http://cisco.com/nm/acs/mgmt/ucp/service/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">failure</multiRef>
</soapenv:Body>
</soapenv:Envelope>
Soap Envelope:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://cisco.com/nm/acs/mgmt/ucp/service/">
<soapenv:Header/>
<soapenv:Body>
<ser:authenticateUser soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<userName xsi:type="xsd:string">myusername</userName>
<password xsi:type="xsd:string">mypassword</password>
</ser:authenticateUser>
</soapenv:Body>
</soapenv:Envelope>
And the WSDL:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions targetNamespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://www.cisco.com/wsdl.service"
xmlns:intf="http://cisco.com/nm/acs/mgmt/ucp/service/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:documentation>Copyright (c) 2007, 2009 Cisco Systems, Inc.
WSDL Service Interface for ACS5.1 User Change Password interface
(UCP) This WSDL document defines the publication API calls for
interacting with the ACS UCP service.</wsdl:documentation>
<wsdl:types>
<schema targetNamespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]" />
</restriction>
</complexContent>
</complexType>
<simpleType name="StatusCodeType">
<restriction base="string">
<enumeration value="success" />
<enumeration value="failure" />
</restriction>
</simpleType>
<complexType name="ResponseType">
<sequence>
<element name="errors" nillable="true"
type="intf:ArrayOf_xsd_string" />
<element name="status" nillable="false"
type="intf:StatusCodeType" />
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="changeUserPassRequest">
<wsdl:part name="userName" type="xsd:string" />
<wsdl:part name="oldPassword" type="xsd:string" />
<wsdl:part name="newPassword" type="xsd:string" />
</wsdl:message>
<wsdl:message name="authenticateUserRequest">
<wsdl:part name="userName" type="xsd:string" />
<wsdl:part name="password" type="xsd:string" />
</wsdl:message>
<wsdl:message name="changeUserPassResponse">
<wsdl:part name="changeUserPassReturn"
type="intf:ResponseType" />
</wsdl:message>
<wsdl:message name="authenticateUserResponse">
<wsdl:part name="authenticateUserReturn"
type="intf:ResponseType" />
</wsdl:message>
<wsdl:portType name="UCP">
<wsdl:operation name="authenticateUser"
parameterOrder="userName password">
<wsdl:input message="intf:authenticateUserRequest"
name="authenticateUserRequest" />
<wsdl:output message="intf:authenticateUserResponse"
name="authenticateUserResponse" />
</wsdl:operation>
<wsdl:operation name="changeUserPass"
parameterOrder="userName oldPassword newPassword">
<wsdl:input message="intf:changeUserPassRequest"
name="changeUserPassRequest" />
<wsdl:output message="intf:changeUserPassResponse"
name="changeUserPassResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="UCP" type="intf:UCP">
<wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="authenticateUser">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="authenticateUserRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
use="encoded" />
</wsdl:input>
<wsdl:output name="authenticateUserResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
use="encoded" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="changeUserPass">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="changeUserPassRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
use="encoded" />
</wsdl:input>
<wsdl:output name="changeUserPassResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://cisco.com/nm/acs/mgmt/ucp/service/"
use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="UCPService">
<wsdl:port binding="intf:UCP" name="UCP">
<wsdlsoap:address location="https://localhost/PI/services/UCP/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Update: This issue has been resolved. I was trying to authenticate various admin accounts which apparently are in a separate database than the user accounts this service talks to. I used a generic user account that I created in CISCO and the web service calls worked great!
I would like to thank #Yahia for the recommendation on running Fiddler also!