WsdlToPhp / PackageGenerator

Generates a PHP SDK based on a WSDL, simple and powerful, WSDL to PHP
https://providr.io
MIT License
417 stars 73 forks source link

WSDL ... Non-WSDL mode? #232

Open faithfulman18 opened 3 years ago

faithfulman18 commented 3 years ago

Hello,

I have a new issue that is related to #231 but I thought it made the most sense to open a new ticket.

So, now that the SOAP packet is being sent in the correct format, the issue now is that server doesn't have the WSDL on it. So, I'm not sure, but I'm thinking that would make me need to use "Non-WSDL" mode??

If so, it appears that the URL is supposed to be null and the uri and location should be filled in. However, this isn't working. If I input the path to the local WSDL, it complains with a SOAPFAULT of "Looks like we got no XML document". (which there isnt' a WSDL on the server side from the vendor) .... but if we leave the URL null, then the package generator is looking for the WSDL file in a local folder on the webserver and bombs out.

Any ideas? Help!?

Thanks!

mikaelcom commented 3 years ago

From my knowledge Looks like we got no XML document means the server did not respond with a valid XML response, not that it has no WSDL on its side.

If you have a WSDL, you can nevertheless set the location, the url, to where the request must be sent because the WSDL may contain a SOAP address location with a localhost url or it might even not contain any.

To set the location of where the request must be sent, you have to call the method setLocation on the SerciveType instance passing the SOAP address location.

Am I mistaken?

faithfulman18 commented 3 years ago

Whoops. I had overwritten my URL variable and it really wasn't pointing to the correct location. So disregard that issue as I do get a response back, but it's only when I pass in the local path to the WSDL in the URL setting. If I don't it also tries to send the SOAP packet, but the format is different:

[With WSDL PATH in the URL optoin -- looks normal and works]

      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => 'myfilepath\this.wsdl',
      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URI => 'http://this namespace.com',
      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \THIS_WSDL\ClassMap::get(),
      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_SOAP_VERSION => SOAP_1_1,
      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CACHE_WSDL => WSDL_CACHE_BOTH,
      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOCATION => $this->url,

{Result}

        <ns1:vendorHeader>
          <ns1:ConsumerName>NAMELISTED</ns1:ConsumerName>
          <ns1:ConsumerProduct>PRODUCTLISTED</ns1:ConsumerProduct>
          ...
          ...
          <ns1:thisPropertyNotBeingUsed/>
        </ns1:vendorHeader>

VS

[No WSDL PATH in the URL option -- looks different and fails from the server side response]

      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URI => 'http://this namespace.com',
      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => \THIS_WSDL\ClassMap::get(),
      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_SOAP_VERSION => SOAP_1_1,
      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CACHE_WSDL => WSDL_CACHE_BOTH,
      \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_LOCATION => $this->url,

{Result}

        <vendorHeader xsi:type="SOAP-ENC:Struct">
          <ConsumerName xsi:type="xsd:string">NAMELISTED</ConsumerName>
          <ConsumerProduct xsi:type="xsd:string">PRODUCTLISTED</ConsumerProduct>
          ...
          ...
          <thisPropertyNotBeingUsed xsi:nil="true"/>
        </vendorHeader>

Any idea why the difference? Am I doing something wrong or missing anything?

mikaelcom commented 3 years ago

I'm not sure to follow, what's the real issue?

faithfulman18 commented 3 years ago

I'm just wondering confused what made it output the SOAP packet differently. I'm not passing the URL parameter the local wsdl in the 2nd instance, and it generates the SOAP similarly, but not the same. It essentially includes the 'ns1:' on all the fields in the first instance and on the one without the local WSDL file path it generates it without the 'ns1' and with those extra 'xsi:' attributes.

Is there a reason behind it? I'm just trying to understand the difference and what is causing it to generate the SOAP packet differently.

faithfulman18 commented 3 years ago

To clarify more ... using the first example does work properly and I get a proper soap response back now. (Yea!)

I was just trying to understand why the output changes when I do not pass in the local URL of the wsdl versus when I do.

mikaelcom commented 3 years ago

If the SoapClient has the WSDL, it can namespace the parameter so you end up with ns1:, otherwise it types the parameter as they are without namespacing them.

faithfulman18 commented 3 years ago

Alright. Thanks.