Code Monkey home page Code Monkey logo

Comments (9)

rhelms avatar rhelms commented on May 23, 2024

I'm not at a computer at the moment, but here are my thoughts.

I think the complexType definition is okay, but there might be an element
definition in the WSDL that generates an object with an employment list
property, and attaches the ArrayOfEmployeeList to that property. Put
another way, the first incorrect example is the second correct example
wrapped in an object with an employee list property.

To fix it, the employee list element would need to be suppressed. However,
I'd need to see the PHPdocs attached to the service to ensure the code
generated is consistent with what has been requested.
On Jun 21, 2014 4:55 AM, "Piotr Olaszewski" [email protected]
wrote:

@rhelms https://github.com/rhelms current I added clients to testing
generated wsdl. Almost all things are ok, but is problem with arrays in
requests. I think your changes make some issues with it. For properly
arrays is needed to construct wsdl like:

<xsd:complexType name="ArrayOfEmployees">
xsd:complexContent
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" arrayType="ns:Employee[]" />
/xsd:restriction
/xsd:complexContent
/xsd:complexType

and this piece of wsdl generate correct array of employees.

But after changes with Document literal wrapper it products:

<xsd:complexType name="ArrayOfEmployeesList">
xsd:sequence
<xsd:element minOccurs="0" maxOccurs="unbounded" name="employeesList" nillable="true" type="ns:Employee" />
/xsd:sequence
/xsd:complexType

which generates something like this:

stdClass Object
(
[employeesList] => Array
(
[0] => stdClass Object
(
[id] => 1
[department] => IT
)

        [1] => stdClass Object
            (
                [id] => 2
                [department] => Logistic
            )

    )

)

and this is incorrect array, must be like this:

Array
(
[0] => stdClass Object
(
[id] => 1
[department] => IT
)

        [1] => stdClass Object
            (
                [id] => 2
                [department] => Logistic
            )

    )

Have you any idea how to fix it?

You can test clients using shell command ./clinet in
wsdl-creator/examples/Clients


Reply to this email directly or view it on GitHub
#17.

from wsdl-creator.

piotrooo avatar piotrooo commented on May 23, 2024

Correct array definition - to understood by PHP is:

<xsd:complexType name="ArrayOfCount">
    <xsd:complexContent>
        <xsd:restriction base="soapenc:Array">
            <xsd:attribute ref="soapenc:arrayType" arrayType="xsd:string[]" />
        </xsd:restriction>
    </xsd:complexContent>
</xsd:complexType>

but now arrays are generated like this:

<xsd:complexType name="ArrayOfNames">
    <xsd:sequence>
        <xsd:element minOccurs="0" maxOccurs="unbounded" name="name" nillable="true" type="xsd:string" />
    </xsd:sequence>
</xsd:complexType>

this approach is using afters document literal wrapped changes, and I'm not quite sure is correct to all of examples.

from wsdl-creator.

rhelms avatar rhelms commented on May 23, 2024

It looks like I've interpreted the goal of the wrapper[] incorrectly, and have made it similar to the object[], which probably still needs investigating.

When seeing wrapper[] $employeeList $className=Employee, I was hoping to get an employeeList element that was an object array of Employee.

<employeeList>
  <employee>
    <id>1</id>
    <department>IT</department>
  </employee>
  <employee>
    <id>2</id>
    <department>Logistic</department>
  </employee>
</employeeList>

But I see that this is probably not the what is expected. I should probably use object $employeeList @(wrapper[] $employee $className=Employee)

From the desired PHP array of:

Array
    (
        [0] => stdClass Object
            (
                [id] => 1
                [department] => IT
            )
        [1] => stdClass Object
            (
                [id] => 2
                [department] => Logistic
            )
    )

it looks liked you'd be wanting to have XML looking like

<SOAP-ENC:Array SOAP-ENC:arrayType="ns:Employee[2]">
  <employee>
    <id>1</id>
    <department>IT</department>
  </employee>
  <employee>
    <id>2</id>
    <department>Logistic</department>
  </employee>
</SOAP-ENC:Array>

To do that, the PHPDoc signature would need to be @param wrapper[] $employeeList @className=Employee as you had originally, but the $employeeList would only be used from the calling function, in the WSDL, and the @classname would be used to generate the types which would be as:

<element name="ArrayOfEmployee">
  <complexType base="SOAP-ENC:Array">
    <element name="employee" type="ns:Employee" maxOccurs="unbounded" />
  </complexType>
</element>

<element name="getEmployeeDepartments">
    <element name="employeeList" type="tns:ArrayOfEmployee" />
</element>

I'll see if I can put something together that follows this method.

from wsdl-creator.

rhelms avatar rhelms commented on May 23, 2024

I'm now discovering why I changed it to a sequence.

When using the SOAP-ENC:Array as you had it, the XML produced for the request does not name the employee elements as anticipated.

Instead of

<employeesList>
  <employee>
    <id>1</id>
    <department>IT</department>
  </employee>
  <employee>
    <id>2</id>
    <department>Logistic</department>
  </employee>      
</employeesList>

I get

<employeesList>
  <SOAP-ENC:Struct>
    <id>1</id>
    <department>IT</department>
  </SOAP-ENC:Struct>
  <SOAP-ENC:Struct>
    <id>2</id>
    <department>Logistic</department>
  </SOAP-ENC:Struct>      
</employeesList>

And only stdClass is used at the server, instead of @classname, even when it is available.

I'll keep working on it.

from wsdl-creator.

rhelms avatar rhelms commented on May 23, 2024

Some progress, but unexpected results at the server.

Using using the sequence method, which is recommended here : http://ws-i.org/profiles/basicprofile-1.2-2010-11-09.html#soapenc_Array, the generated XML is

<employeesList>
  <employee>
    <id>1</id>
    <department>IT</department>
  </employee>
  <employee>
    <id>2</id>
    <department>Logistic</department>
  </employee>      
</employeesList>

which is what we want, specially when talking to non-PHP servers that are using wrapped document/literal.

However, at the server, this gets interpreted as an array of employee, as follows:

$employeesList stdClass Object
(
    [employee] => Array
        (
            [0] => stdClass Object
                (
                    [id] => 1
                    [department] => IT
                )

            [1] => stdClass Object
                (
                    [id] => 2
                    [department] => Logistic
                )

        )

)

Apparently, this is the nature of the wrapped document/literal style, and usage of SOAP-ENC:Array and restrictions is not advised.

I'm going to tidy some of the wrapped document/literal examples, so they work the way they are supposed to.

from wsdl-creator.

piotrooo avatar piotrooo commented on May 23, 2024

Im not now at the computer. One question - are you using examples provided
by me? This examples are all functionallity I want handle by the creator.
As you can see I created xml files with soapUI configurations, feel free to
using its.
When you search FIXME string in examples, I marked all incorrect working
methods with short description.
Additinally I little modify DocumentLiteralWrapper for input params, but
this is involved with #18 issue.

When I'll be at the computer I give you place in team member, you will be
able to commit changes directly to repo. This make work more comfortable
for polish - australian time zones.
23 cze 2014 05:17 "Reuben" [email protected] napisa³(a):

Some progress, but unexpected results at the server.

Using using the sequence method, which is recommended here :
http://ws-i.org/profiles/basicprofile-1.2-2010-11-09.html#soapenc_Array,
the generated XML is

1 IT 2 Logistic

which is what we want, specially when talking to non-PHP servers that are
using wrapped document/literal.

However, at the server, this gets interpreted as an array of employee, as
follows:

$employeesList stdClass Object
(
[employee] => Array
(
[0] => stdClass Object
(
[id] => 1
[department] => IT
)

        [1] => stdClass Object
            (
                [id] => 2
                [department] => Logistic
            )

    )

)

Apparently, this is the nature of the wrapped document/literal style, and
usage of SOAP-ENC:Array and restrictions is not advised.

I'm going to tidy some of the wrapped document/literal examples, so they
work the way they are supposed to.

Reply to this email directly or view it on GitHub
#17 (comment)
.

from wsdl-creator.

rhelms avatar rhelms commented on May 23, 2024

Hi Piotr

Yes, I'm using the examples set up in the repo, though I've had to alter
the localhost to something else, as I have several versions of Apache and
PHP running on my machine, plus IIS as well!

Thanks for the membership, but I think I will still submit pull requests
from my personal repo, just in case the code is not in the right direction
you would like it to be.

Regards
Reuben Helms

On Mon, Jun 23, 2014 at 2:35 PM, Piotr Olaszewski [email protected]
wrote:

Im not now at the computer. One question - are you using examples provided
by me? This examples are all functionallity I want handle by the creator.
As you can see I created xml files with soapUI configurations, feel free
to
using its.
When you search FIXME string in examples, I marked all incorrect working
methods with short description.
Additinally I little modify DocumentLiteralWrapper for input params, but
this is involved with #18 issue.

When I'll be at the computer I give you place in team member, you will be
able to commit changes directly to repo. This make work more comfortable
for polish - australian time zones.
23 cze 2014 05:17 "Reuben" [email protected] napisa³(a):

Some progress, but unexpected results at the server.

Using using the sequence method, which is recommended here :
http://ws-i.org/profiles/basicprofile-1.2-2010-11-09.html#soapenc_Array,

the generated XML is

1 IT 2 Logistic

which is what we want, specially when talking to non-PHP servers that
are
using wrapped document/literal.

However, at the server, this gets interpreted as an array of employee,
as
follows:

$employeesList stdClass Object
(
[employee] => Array
(
[0] => stdClass Object
(
[id] => 1
[department] => IT
)

[1] => stdClass Object
(
[id] => 2
[department] => Logistic
)

)

)

Apparently, this is the nature of the wrapped document/literal style,
and
usage of SOAP-ENC:Array and restrictions is not advised.

I'm going to tidy some of the wrapped document/literal examples, so they
work the way they are supposed to.

Reply to this email directly or view it on GitHub
<
https://github.com/piotrooo/wsdl-creator/issues/17#issuecomment-46803159>
.


Reply to this email directly or view it on GitHub
#17 (comment)
.

from wsdl-creator.

piotrooo avatar piotrooo commented on May 23, 2024

No worries revert commits are able :)

from wsdl-creator.

piotrooo avatar piotrooo commented on May 23, 2024

New annotations, provided.

from wsdl-creator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.