I write standalone SOAP server using Delphi. It contains function returning version of the server, e.g.:
function TMySOAP.GetVersion: string; stdcall;
begin
Result := '1.0';
end;
According to some specification the output value of the function should have the name 'Result', so the WSDL should look like this:
<message name="GetVersion3Response">
<part name="Result" type="xs:string"/>
</message>
But because Delphi uses identifier 'Result' in it's own purposes, my server generates next WSDL:
<message name="GetVersion3Response">
<part name="return" type="xs:string"/>
</message>
The name of the output parameter is hardcoded in the specification and client programs can not process answer of my server correctly because of name mismatch.
Is there any way to change the name of output parameter to 'Result'?
Find an answer by myself:
procedure TMySOAP.GetVersion(out Result: string); stdcall;
begin
Result := '1.0';
end;
Seems it works.
Related
I'm using python 2.7 and Spyne for creating some web services in Django.
I'm not able to change the name of the returned values, for example:
Given this code:
class Consumer(ServiceBase):
#rpc(Integer,Integer, _returns = [Integer,Integer])
def addConsumer(ctx, topic_id, consumer_id):
...
...
The response in my wsdl looks like:
<xs:sequence>
<xs:element name="addConsumerResult0" type="xs:integer" minOccurs="0" nillable="true"/>
<xs:element name="addConsumerResult1" type="xs:integer" minOccurs="0" nillable="true"/>
</xs:sequence>
I am looking for something that allow me to change name="addConsumerResult0" to name="whateverXYZ"
You can use _out_variable_names to change return type names.
e.g.
class Consumer(ServiceBase):
#rpc(Integer,Integer, _returns = [Integer,Integer],
_out_variable_names=["whateverXYZ", "foo"])
def addConsumer(ctx, topic_id, consumer_id):
...
...
I have problem in copying the output of a service response to the response message in BPEL .
The amount element has an attribute currency, How do I acheiev this ? All other copying seems to work fine, except copying an element to an attribute of another element.
The copy expression is below.
<copy>
<from variable="InvokePersistence_insert_OutputVariable"
part="ProBookingInitiationCollection" query="/ns3:ProBookingInitiationCollection/ns3:ProBookingInitiation/ns3:bookingDetail/ns3:isoCurrencyCd"/>
<to variable="outputVariable" part="payload"
query="/ns4:BookingConfirmation/ns4:amount/#ns4:currency"/>
</copy>
The excerpts from xsd is below
<xs:element name="amount">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currency" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
Make sure that "outputVariable" output variable is properly initialised according to the schema and contains an attribute called "currency"
We have developed Webservices using Apache CXF , and they are working fine .
This is some part of our generated wsdl file (http://localhost:8080/MyWeb/tata/soap?wsdl).
<xs:sequence>
<xs:element minOccurs="0" name="strikePrice" type="xs:double"/>
<xs:element minOccurs="0" name="symbol" type="xs:string"/>
</xs:sequence>
<soap:body use="literal"/>
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
We have developed Webservices using Apache CXF , and they are working fine .
While reading webservice performance tuning tutorials , i read always use document literal for interoperabilty .
My question is , is my WSDL is document /literal ??
Because most of the tutorials in internet , represent xsd:String in place of (xs:String) for representing document/literal approach ??
Are xs:String and xsd:String are same ??
xs:string and xsd:string are the same, provided that the "xs" and "xsd" prefixes are both bound to the namespace URI "http://www.w3.org/2001/XMLSchema".
We have JAX-RPC style web service, with a complex type defined as follows:
<xs:complexType name = "SomeFault">
<xs:sequence>
<xs:element name = "errorMessages" type="some:ErrorMessageWSType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name = "ErrorMessageWSType">
<xs:restriction base = "xs:NMTOKEN">
<xs:enumeration value = "INVALID_1"/>
<xs:enumeration value = "INVALID_2"/>
<xs:enumeration value = "INVALID_3"/>
</xs:restriction>
</xs:simpleType>
We are running into Marshaling exception on the server side when the response/fault complex type has a single array type field.
weblogic.wsee.codec.CodecException: Failed to encode
com.bea.xml.XmlException: failed to find a suitable binding type for
use in marshalling object
"[Lnamespace.type.ErrorMessageWSType;#693767e9". using schema type:
t=SomeFault#http://namespace/SOME/v1 java
type:namespace.type.ErrorMessageWSType[]
If we change SomeFault, by adding another element to the complex type the error goes away.
<xs:complexType name = "SomeFault">
<xs:sequence>
<xs:element name = "errorMessages" type="some:ErrorMessageWSType" maxOccurs="unbounded" />
<xs:element name = "dummyString" type="xsd:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
Are we doing something wrong during the wsdlc code generation or is this a known issue?
A similar question is already posted at https://forums.oracle.com/forums/thread.jspa?messageID=4462906, but without any response, any pointers would be great.
Thanks.
Don't know if this solves the "why" part of the question, but you could try rewriting the sequence part like:
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="errorMessages" type="some:ErrorMessageWSType"/>
</xs:sequence>
OTOH, what might be the mechanism that lets the second case work, but not the first?
Might it be that the marshaller then has to figure out what xsd:string means before checking what some:ErrorMessageWSType means, and then has to wake up a resolver or something?
This line of thought leads to the second approach I would try, which would be to declare ErrorMessageWSType before SomeFault (and perhaps in another namespace, just to see if that fixes anything).
Just my (tired) two cents, and I guess that both of these approaches presume a bug of some sort in the marshaller, because I can't really see that anything in your example code isn't according to the XML schema definition.
I'm trying to consume a .Net web service of mine in a Flex Builder 3 project. The function's signature in the service is:
bool MyFunction(Enums.Channels var1, Enums.Payments.PayMethods var2)
I tried importing the WSDL with the wizard but when I tried to call the web service it results in an error stating
"Cannot marshall type "http://www.w3.org/2001/XMLSchema::EnumsChannel"
to simple type"
What kind of object do I need to create in Flex Builder 3 to pass into the webservice so that it will recognize it as the appropriate type? The wizard is not correctly creating the appropriate type. Here is the xsd for the enums.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.datacontract.org/2004/07/My.Shared" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/My.Shared">
<xs:simpleType name="Enums.Channels">
<xs:restriction base="xs:string">
<xs:enumeration value="Web"/>
<xs:enumeration value="ContactCenter"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="Enums.Channels" nillable="true" type="tns:Enums.Channels"/>
<xs:simpleType name="Enums.Payments.PayMethods">
<xs:restriction base="xs:string">
<xs:enumeration value="CreditCard"/>
<xs:enumeration value="PayPal"/>
<xs:enumeration value="eBillme"/>
<xs:enumeration value="BillMeLater"/>
<xs:enumeration value="TeleCheck"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="Enums.Payments.PayMethods" nillable="true" type="tns:Enums.Payments.PayMethods"/>
</xs:schema>
I'd like to try to build my own objects to call the service myself (without the wizard).... created the mx:WebService and mx:Operation but not sure how to handle the enum parameters.
I suppose this is a bit similar to this question Flex, .NET Web Service and Numeric Enums but a bit reversed.
try this
<s:WebService id="myWS" wsdl="yourServicePath?WSDL" result="resultHandler(event)" fault="faultHandler(event)">
<s:operation name="MyFunction">
<s:request xmlns="">
<var1>{var1 value}</var1>
<var2>{var2 value}</var2>
</s:request>
</s:operation>
</s:WebService>
to call the webservice: type
myWS.MyFunction.send();