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

How to specify custom name for <wsdl:message> #484

Closed
sankakiran opened this issue May 28, 2020 · 20 comments
Closed

How to specify custom name for <wsdl:message> #484

sankakiran opened this issue May 28, 2020 · 20 comments
Labels

Comments

@sankakiran
Copy link

We are planning to migrate existing WCF services to .Net core. Service consumers should not be impacted with this code migration. So we have to produce the same wsdl similar to WCF.
I found message name difference in generated wsdl compared to old wsdl, which required changes at client end.

SoapCore:

<wsdl:message name = "MemberSoap_addMember_InputMessage">
   <wsdl:part name = "parameters" element = "tns:addMember" />
</wsdl:message>
<wsdl:portType name = "MemberSoap">
   <wsdl:opertion name = "addMember">
       <wsdl:input message = "MemberSoap_addMember_InputMessage" />
   </wsdl:operation>
</wsdl:portType>

WCF:

<wsdl:message name = "MemberSoapIn">
   <wsdl:part name = "parameters" element = "tns:addMember" />
</wsdl:message>
<wsdl:portType name = "MemberSoap">
   <wsdl:opertion name = "addMember">
       <wsdl:input message = "MemberSoapIn" />
   </wsdl:operation>
</wsdl:portType>

I tried with "MessageContractAttribute" but not reflected in wsdl.
We need help to rename the message name.

@kotovaleksandr
Copy link
Member

Hi! Are you sure what message name impact for service behavior?
Whats differ MemberSoap_addMember_InputMessage against MemberSoapIn?
Its simple alias for operations, it can be message1, message2 or something else.
Its not a part of contract.

https://www.w3.org/TR/wsdl.html#_messages

You have specific problems with web service on soapcore and client interaction?

@sankakiran
Copy link
Author

one of our application consumers have hard coded the message names. So we need same message name to be reflected with SoapCore.

@kotovaleksandr
Copy link
Member

No, again: message name is not a part of contract, you can't hardcode them.
Example, my service definition:
image

And method call throw SoapUI:
image

Message name doesn't affect to client-server communication. You can't set them on any framework, it's internal detail of WSDL generator implementation.

If your client application which generate client code by WSDL except specific message names pattern - it's not correct, by specification message name can be any unique string.

Please describe concrete problem.

@sankakiran
Copy link
Author

If there is change in message names then request and response objects are become Null.
Client application is on Seibel technology where as they have hard coded the message names. This is only issue with this seibel client and rest of the applications are not impacted with name change.
We had similar problem when we migrate webservice (asmx) to wcf (svc) and it was resolved by adding MessageContracts to override the message name.
If there is no option then will ask our app consumers to change their code.

@jrwarwick
Copy link

I've run into a scenario similar to sankakiran. In addition to the message names, it is not clear to me how (or if I can) control the portType name (without doing something weird to the interface class names or something). Even though what SoapCore is doing is technically sound and maps nicely between the WSDL and the source, sometimes you are just dealing with large companies that are very, very difficult to even communicate with, let alone persuade to make a change. If I cannot make a transparent drop-in replacement (that will pass all of their mysterious validation checks and so on) I'm probably out of luck (as I'm sure sankakiran ended up).

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jul 20, 2021
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

@Ogabek-Kholmirzaev
Copy link

We are planning to migrate existing WCF services to .Net core. Service consumers should not be impacted with this code migration. So we have to produce the same wsdl similar to WCF. I found message name difference in generated wsdl compared to old wsdl, which required changes at client end.

SoapCore:

<wsdl:message name = "MemberSoap_addMember_InputMessage">
   <wsdl:part name = "parameters" element = "tns:addMember" />
</wsdl:message>
<wsdl:portType name = "MemberSoap">
   <wsdl:opertion name = "addMember">
       <wsdl:input message = "MemberSoap_addMember_InputMessage" />
   </wsdl:operation>
</wsdl:portType>

WCF:

<wsdl:message name = "MemberSoapIn">
   <wsdl:part name = "parameters" element = "tns:addMember" />
</wsdl:message>
<wsdl:portType name = "MemberSoap">
   <wsdl:opertion name = "addMember">
       <wsdl:input message = "MemberSoapIn" />
   </wsdl:operation>
</wsdl:portType>

I tried with "MessageContractAttribute" but not reflected in wsdl. We need help to rename the message name.

Hi, are you able to change MenberSoap_receivePayment_InputMessage in SoapCore?

@andersjonsson
Copy link
Collaborator

There is no built in way to override the naming and changing the default behavior in SoapCore could break existing code for a lot of people.

You are more than welcome to submit a PR with an override option. I'm not sure if using MessageContractAttribute, or adding custom attributes to the operation method is the cleanest solution. What do you think?

@andersjonsson andersjonsson reopened this May 28, 2024
@andersjonsson
Copy link
Collaborator

andersjonsson commented May 28, 2024

It is also worth noting that differing message names shouldn't matter in most cases. I was able to switch my legacy service without breaking anyone even though the message name in the wsdl was altered.
I might be missing something but I think the only case that would break is if someone has hard-coded wsdl-verification that requires a specifik message name

@Ogabek-Kholmirzaev
Copy link

@andersjonsson Could you help me with WSDL template. Given a WSDL template to me to implement server side soap service. I need to do the same to the given WSDL. I couldn't do it in SoapCore. How could I do it?

If you could help me, send me email address or any social app account adress I will send you the WSDL template.

@andersjonsson
Copy link
Collaborator

No, unfortunately I'm not going to be able to help you with that.

@andersjonsson
Copy link
Collaborator

I just remembered that this PR #1044 already implements the ability to change naming strategy for the input-output messages.
Hopefully it can be merged quite soon

@github-actions github-actions bot removed the stale label May 29, 2024
@Ogabek-Kholmirzaev
Copy link

image
image
image
image

@andersjonsson I need you help. Sorry for interrupting again. Thank you your answer in advance!

I'm using SoapCore package. I have a getSubject method in SOAP interface. As you see, this method has 2 parametres(settlement & List subject). In the subject parameter, its type is ArrayOfSubjectinfo. I need to change this to subjectinfo, I can do it below in the payment class.

@andersjonsson
Copy link
Collaborator

I'm not sure that I understand what you're trying to do here, but you can solve this with a custom class

[XmlType(TypeName = "subject")]
public class SubjectList: List<SubjectInfo>
{
	public SubjectList(int capacity)
	{
		Capacity = capacity;
	}

	public SubjectList()
	{
	}
}

Then use that type as your parameter instead of List

@Ogabek-Kholmirzaev
Copy link

image

After this, I need to make unbounded in WSDL. How can I do it?

@andersjonsson
Copy link
Collaborator

That type becomes a complextype that is marked as unbounded (in the type declaration within your WSDL).
My guess is that this wsdl will work in your use case even though it differs slightly from the original one.

I can't think of a way to make it unbounded on that level and still be able to specify the type name, so I can't help you with this

@andersjonsson
Copy link
Collaborator

No, I can't help you any more than I already have.

Copy link

github-actions bot commented Jul 6, 2024

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jul 6, 2024
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

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

No branches or pull requests

5 participants