Skip to main content

Changing the Web Service Client String Default

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

The generated COBOL Web Service Clients default to PIC X(100) for strings. This can cause issues as more than 100 characters may be returned in a string.  This article will provide an example of amending the WSDL to specify the string size needed and then the COBOL Client is generated within Net Express from the amended WSDL.

Resolution:

The example:

<?xml version="1.0"?>

<definitions name="CATrafficService" targetNamespace="http://www.xmethods.net/sd/CATrafficService.wsdl" xmlns:tns="http://www.xmethods.net/sd/CATrafficService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:new="new">

<types>

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="new">

<simpleType name="string2">

<restriction base="string">

<length value="1000"/>

</restriction>

</simpleType>

</schema>

</types>

<message name="getTrafficRequest">

<part name="hwynums" type="xsd:string"/>

</message>

<message name="getTrafficResponse">

<part name="return" type="new:string2"/>

</message>

<portType name="CATrafficPortType">

<operation name="getTraffic">

<input message="tns:getTrafficRequest" name="getTraffic"/>

<output message="tns:getTrafficResponse" name="getTrafficResponse"/>

</operation>

</portType>

<binding name="CATrafficBinding" type="tns:CATrafficPortType">

<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

<operation name="getTraffic">

<soap:operation soapAction="" />

<input name="getTraffic">

<soap:body use="encoded" namespace="urn:xmethods-CATraffic" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

</input>

<output name="getTrafficResponse">

<soap:body use="encoded" namespace="urn:xmethods-CATraffic" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

</output>

</operation>

</binding>

<service name="CATrafficService">

<documentation>Provides information on California Highway Conditions.</documentation>

<port name="CATrafficPort" binding="tns:CATrafficBinding">

<soap:address location="http://services.xmethods.net:80/soap/servlet/rpcrouter"/>

</port>

</service>

</definitions>

You can see that here we have added the new type "Strings" in the "new" namespace that has a size of 1000. The return string is specified to be of this new type.

When the COBOL Web Service client is generated from this WSDL it will be of the type PIC X(1000).

Old KB# 5230

0 replies

Be the first to reply!