Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayOfString maxOccurs 1 #988

Closed
Griboedoff opened this issue Jan 16, 2024 · 8 comments · Fixed by #995
Closed

ArrayOfString maxOccurs 1 #988

Griboedoff opened this issue Jan 16, 2024 · 8 comments · Fixed by #995

Comments

@Griboedoff
Copy link

Hi!

<xsd:complexType name="ArrayOfString">
    <xsd:sequence>
        <xsd:element minOccurs="0" maxOccurs="1" name="string" type="xsd:string"/>
    </xsd:sequence>
</xsd:complexType>

For unknown reason when I use SoapCore ArrayOfString in wsdl generated with maxOccurs="1" instead of maxOccurs="unbounded" attribute like it generates in WCF.
I'm using xmlSerializer

What info I could provide?

@andersjonsson
Copy link
Collaborator

That's odd. In my own services ArrayOfString gets maxOccurs="unbounded" as expected.
What is the signature of the methods/objects with string-collections?

My suggestion would be to fork the repo, setting up a test with a small service to reproduce your issue.
That way you can debug into MetaBodyWriter and see what's going on

@Griboedoff
Copy link
Author

In sample projects I use

[ServiceContract]
public class WebService
{
    [OperationContract]
    public void DoStuff(string[] arrayArg) {}
}

Ok, I'll try to fork when I have time to tinker it a bit)

vidrenning added a commit to vidrenning/SoapCore that referenced this issue Jan 30, 2024
This is a regression of DigDes#960.
In commit 5026da3, the AddSchemaType()
method was changed to contain a special case for string and byte[].
However this breaks the situation where the inner type of a list is
string. In that case, maxOccurs must be set to "unbounded" for the
string element. So this commit reverts that change and instead fixes the
original issue at another place.

Fixes DigDes#988
@vidrenning
Copy link
Contributor

I am able to reproduce this issue and uploaded a pull request for a fix. It is a regression of #960. I also added a test that can be used to reproduce this issue and verify that it is now fixed.

@Alexcei88
Copy link

Alexcei88 commented Feb 9, 2024

I have updated to the 1.1.0.43 version and still see the same issue. It looks like the problem have not been fixed.

@vidrenning
Copy link
Contributor

It works for me. Please give a small reproducible example of your issue.

@Alexcei88
Copy link

Alexcei88 commented Feb 9, 2024

The contract of the service is the same as above one attached by Griboedoff.
The serializer is overriden to xml

options.SoapSerializer = SoapSerializer.XmlSerializer;

If I will switch to the default value (DataContract serializer), it is ok.

@vidrenning
Copy link
Contributor

Just tested it again with v1.1.0.43 and the example class above. This is what I get:

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

As you can see, it shows maxOccurs="unbounded". Are you sure that you are using the newest version of the package? Are you looking at the right place for the ArrayOfString definition?

@Alexcei88
Copy link

Alexcei88 commented Feb 9, 2024

Oh, sorry, Looks like it was the old version of library. Now it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants