CV3 Web Service Replication

From NewHaven Software Wiki

Jump to: navigation, search

Contents

Intro

Before CMS v9 and it's ability to use "plug-ins" to connect to websites, the only integration CMS had with websites was via the eCMS Module and its connection to CommerceV3 (CV3). If integration with other sites was desired the only recourse was to mimic the CV3(NHS) web service and then redirect CMS to point at the replicated web service you are hosting. With the new eCMS Module plug-in system this replication method is largely no longer necessary since a plug-in can be designed to work specifically with you cart. The following information is retained here for reference and archival purposes should it still be valuable.

Noting the difference between CV3(NHS) and CV3(Public). CV3(NHS) is the web service CV3 hosts specifically for CMS to connect to. NHS worked with CV3 to develop their first order management system integration which resulted in their hosting this web service. Since that time CV3 has developed a "public" web service which can be used by any order management system, not just CMS, and thus is rather different than the CV3(NHS) web service. All future development/maintenance by NHS and CV3 will only be done on the CV3(Public) web service. NHS and CV3 consider the CV3(NHS) to be a legacy solution and anticipate it being moved to an End of Life status in 2017.

The replication method described in this article only works with CV3(NHS) web service/WSDL.

The resulting SoapAction produced by CMS is based on the supplied AlternateURL concatenated with the method call required for the operation. For example:

SOAPAction: "https://mywebsite.com/services/CMS_Services.php/downloadOrders"

Legacy Article on CV3(NHS) Web Service Replication

In order to create a web service that CMS can talk to, which mimics the CV3(NHS) web service (not the CV3 Public web service), you must first accept the following methods into your web service:


You can compare this to the wsdl located here: https://ecms.commercev3.com/services/serviceCV3.php?wsdl

About Responses

All responses are base64 encoded and look like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:xsd="http://www.w3.org/2001/XMLSchema"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"  xmlns:si="http://soapinterop.org/xsd">
<SOAP-ENV:Body><downloadOrdersResponse>
<return xsi:type="xsd:base64Binary">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiID8+Cgo8Q01TRGF0YSBTY2hlbWFWZXJzaW9uPSI1LjAiPgo8T3JkZXJzPgo8L09yZGVycz4KCjwvQ01TRGF0YT4K</return></downloadOrdersResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>


All the responses below are only the encoded section which is base64 encoded xml.

The XML is expected to be in the CMS XML format. See the CMSxml.xsd for more info.

downloadOrders

Sample Request

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soapinterop.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:downloadOrders soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <store_id xsi:type="xsd:integer">2226</store_id>
         <username xsi:type="xsd:string">cms_test</username>
         <password xsi:type="xsd:string">testpass</password>
         <version xsi:type="xsd:string"></version>
      </soap:downloadOrders>
   </soapenv:Body>
</soapenv:Envelope>

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
 
<CMSData>
<Orders>
<Order>            
            <OrderDate>2011-09-15T22:31:38</OrderDate>
            <OrderTotal>52.85</OrderTotal>
            <ItemTotal>57.85</ItemTotal>
            <StateTaxes>0.00</StateTaxes>
            <ShippingCharges>5.00</ShippingCharges>
			<Discount>10.00</Discount>
            <AdCode>XMAS11</AdCode>
			<RefOrderID>Ex1-SizeDisc2</RefOrderID>
            <Notes>Please do not substitute.</Notes>
            <Customer>
                        <ContactAddress>
                                    <ContactName>
                                                <FirstName>Robert</FirstName>
                                                <MiddleInitial>A</MiddleInitial>
                                                <LastName>Schneider</LastName>
                                                <Company></Company>
                                                <Title></Title>
                                    </ContactName>
                                    <Address>
                                                <AddressLine3>3555 Willows Rd</AddressLine3>
                                                <City>Cape Coral</City>
                                                <State>FL</State>
                                                <PostalCode>33904</PostalCode>
                                                <CountryID>840</CountryID>
                                                <Email>lschneider1@example.com</Email>
                                    </Address>
                        </ContactAddress>
                        <PhoneNumber>
                                    <PhoneNumDigits>2399459920</PhoneNumDigits>
                                    <PhoneNumberType>Home</PhoneNumberType>
                        </PhoneNumber>
            </Customer>
            <Recipient>
                        <ShipToAddress>
                                    <ContactName>
                                                <FirstName>Robert</FirstName>
                                                <MiddleInitial>A</MiddleInitial>
                                                <LastName>Schneider</LastName>
                                                <Company></Company>
                                                <Title></Title>
                                    </ContactName>
                                    <Address>
                                                <AddressLine3>3555 Willows Rd</AddressLine3>
                                                <City>Cape Coral</City>
                                                <State>FL</State>
                                                <PostalCode>33904</PostalCode>
                                                <CountryID>840</CountryID>
                                                <Email>lschneider1@example.com</Email>
                                    </Address>
                        </ShipToAddress>
						<Item>
                                    <ProductCode>SHIRT123</ProductCode>
									<SizeName>L</SizeName>
									<ColorName>Army Green</ColorName>
                                    <OrderQuantity>2</OrderQuantity>
                                    <UnitPrice>19.95</UnitPrice>
                                    <TotalPrice>39.90</TotalPrice>
						</Item>
						<Item>
                                    <ProductCode>SHIRT123</ProductCode>
									<SizeName>Small</SizeName>
									<ColorName>Leather</ColorName>
                                    <OrderQuantity>1</OrderQuantity>
                                    <UnitPrice>17.95</UnitPrice>
                                    <TotalPrice>17.95</TotalPrice>
									<ProductDescription>Our Finest Shirt</ProductDescription>
									<CustomizationLine>Optional customization text, no limit on characters</CustomizationLine>
									<SerialNumber>Optional serial number, any text up to 50 characters</SerialNumber>
									<CustomizationUser1>Optional user-defined field/attribute up to 50 characters</CustomizationUser1>
									<CustomizationUser2>Optional user-defined field/attribute up to 50 characters</CustomizationUser2>
                        </Item>
                        <PhoneNumber>
                                    <PhoneNumDigits>9325499920</PhoneNumDigits>
                                    <PhoneNumberType>Home</PhoneNumberType>
                        </PhoneNumber>
						<Package></Package>
                        <GiftMessage></GiftMessage>
            </Recipient>
            <Payment>
                        <PaymentAmount>52.85</PaymentAmount>
                        <PaymentType>Visa</PaymentType>
						<PaymentName>Robert A Schneider</PaymentName>
                        <CardInfo>
                                    <AccountNumber>4444444444444448</AccountNumber>
                                    <ExpirationDate>2014-09</ExpirationDate>
                                    <CardInfoFlags Captured="false" ECommerce="true"></CardInfoFlags>
									<CVC>123</CVC>
                        </CardInfo>
                        <PaymentFlags></PaymentFlags>
            </Payment>
			<DefaultShipMethod IndexBy="Code">U</DefaultShipMethod>
            <OrderFlags></OrderFlags>
</Order>
<Order>
            <OrderDate>2011-09-15T22:31:38</OrderDate>
            <OrderTotal>60.95</OrderTotal>
            <ItemTotal>59.95</ItemTotal>
            <StateTaxes>0.00</StateTaxes>
            <ShippingCharges>6.00</ShippingCharges>
			<Adjustment>-5.00</Adjustment>
            <AdCode>WEB123</AdCode>
            <RefOrderID>Ex2-Ship2Wrk</RefOrderID>
            <Notes></Notes>
            <Customer>
                        <ContactAddress>
                                    <ContactName>
                                                <FirstName>Robert</FirstName>
                                                <MiddleInitial>A</MiddleInitial>
                                                <LastName>Schneider</LastName>
                                                <Company></Company>
                                                <Title></Title>
                                    </ContactName>
                                    <Address>
                                                <AddressLine3>3555 Willows Rd</AddressLine3>
                                                <City>Cape Coral</City>
                                                <State>FL</State>
                                                <PostalCode>33904</PostalCode>
                                                <CountryID>840</CountryID>
                                                <Email>schneider@example.com</Email>
                                    </Address>
                        </ContactAddress>
                        <PhoneNumber>
                                    <PhoneNumDigits>2399459920</PhoneNumDigits>
                                    <PhoneNumberType>Home</PhoneNumberType>
                        </PhoneNumber>
            </Customer>
            <Recipient IsPurchaser="true">
                        <ShipToAddress>
                                    <ContactName>
                                                <FirstName>Robert</FirstName>
                                                <MiddleInitial>A</MiddleInitial>
                                                <LastName>Schneider</LastName>
                                                <Company>The Schneid Corp</Company>
                                                <Title></Title>
                                    </ContactName>
                                    <Address>
                                                <AddressLine3>987 5th Ave Ste 311</AddressLine3>
                                                <City>Cape Coral</City>
                                                <State>FL</State>
                                                <PostalCode>33904</PostalCode>
                                                <CountryID>840</CountryID>
                                                <Email>schneider@example.com</Email>
                                    </Address>
                        </ShipToAddress>
						<Item>
                                    <ProductCode>LLGOSD</ProductCode>
                                    <OrderQuantity>1</OrderQuantity>
                                    <UnitPrice>59.95</UnitPrice>
                                    <TotalPrice>59.95</TotalPrice>
									<ProductDescription>Our Finest product</ProductDescription>
                        </Item>
                        <PhoneNumber>
                                    <PhoneNumDigits>9325499920</PhoneNumDigits>
                                    <PhoneNumberType>Home</PhoneNumberType>
                        </PhoneNumber>
						<Package></Package>
                        <GiftMessage></GiftMessage>
            </Recipient>
			<Payment>
                        <PaymentAmount>60.95</PaymentAmount>
                        <PaymentType>MasterCard</PaymentType>
						<PaymentName>Robert Schneider</PaymentName>
                        <CardInfo>
                                    <AccountNumber>5432111111111111</AccountNumber>
                                    <ExpirationDate>2014-09</ExpirationDate>
                                    <CardInfoFlags Captured="false" ECommerce="true"></CardInfoFlags>
									<CVC>123</CVC>
                        </CardInfo>
                        <PaymentFlags></PaymentFlags>
            </Payment>
            <DefaultShipMethod IndexBy="Code">U</DefaultShipMethod>
			<OrderFlags></OrderFlags>
</Order>
<Order>
            <OrderDate>2011-09-15T22:31:38</OrderDate>
            <OrderTotal>63.95</OrderTotal>
            <ItemTotal>59.95</ItemTotal>
            <StateTaxes>0.00</StateTaxes>
            <ShippingCharges>5.00</ShippingCharges>
            <Adjustment>-1.00</Adjustment>
            <AdCode>TVLGOS</AdCode>
			<SalesPersonInitials>LUK</SalesPersonInitials>
            <RefOrderID>Ex3GiftOrder</RefOrderID>
            <Notes></Notes>
            <Customer>
                        <ContactAddress>
                                    <ContactName>
                                                <FirstName>Robert</FirstName>
                                                <MiddleInitial>A</MiddleInitial>
                                                <LastName>Schneider</LastName>
                                                <Company></Company>
                                                <Title></Title>
                                    </ContactName>
                                    <Address>
                                                <AddressLine3>3555 Willows Rd</AddressLine3>
                                                <City>Cape Coral</City>
                                                <State>FL</State>
                                                <PostalCode>33904</PostalCode>
                                                <CountryID>840</CountryID>
                                                <Email>rrschneider@example.com</Email>
                                    </Address>
                        </ContactAddress>
                        <PhoneNumber>
                                    <PhoneNumDigits>2399459920</PhoneNumDigits>
                                    <PhoneNumberType>Home</PhoneNumberType>
                        </PhoneNumber>
            </Customer>
            <Recipient IsPurchaser="false">
                        <ShipToAddress>
                                    <ContactName>
                                                <FirstName>Jimmy</FirstName>
                                                <MiddleInitial></MiddleInitial>
                                                <LastName>Dean</LastName>
                                                <Company>Farm Fresh Sausage, Link</Company>
                                                <Title></Title>
                                    </ContactName>
                                    <Address>
                                                <AddressLine3>123 Fryers Rd</AddressLine3>
                                                <City>Cape Coral</City>
                                                <State>FL</State>
                                                <PostalCode>33904</PostalCode>
                                                <CountryID>840</CountryID>
                                                <Email>jdean@example.com</Email>
                                    </Address>
                        </ShipToAddress>
                        <Item>
                                    <ProductCode>GLCCD</ProductCode>
                                    <OrderQuantity>1</OrderQuantity>
                                    <UnitPrice>59.95</UnitPrice>
                                    <TotalPrice>59.95</TotalPrice>
									<ProductDescription>Our Next Finest kit</ProductDescription>
                        </Item>
                        <PhoneNumber>
                                    <PhoneNumDigits>9325499920</PhoneNumDigits>
                                    <PhoneNumberType>Home</PhoneNumberType>
                        </PhoneNumber>
						<Package></Package>
                        <GiftMessage>Happy Birthday Jimmy!</GiftMessage>
            </Recipient>
            <Payment>
                        <PaymentAmount>63.95</PaymentAmount>
                        <PaymentType>Visa</PaymentType>
						<PaymentName>Robert A Schneider</PaymentName>
                        <CardInfo>
                                    <AccountNumber>4444444444444448</AccountNumber>
                                    <ExpirationDate>2015-09</ExpirationDate>
                                    <CardInfoFlags Captured="false" ECommerce="true"></CardInfoFlags>
									<CVC>123</CVC>
                        </CardInfo>
                        <PaymentFlags></PaymentFlags>
            </Payment>
 
            <DefaultShipMethod IndexBy="Code">U</DefaultShipMethod>
            <OrderFlags></OrderFlags>
</Order>
</Orders>
<CatalogRequests>
<CatalogRequest ID="123456781">
<Customer>
	<ContactAddress>
		<ContactName>
			<FirstName>Alejandro</FirstName>
			<MiddleInitial></MiddleInitial>
			<LastName>Gallardo</LastName>
			<Company>Unataki</Company>
			<Title>CEO</Title>
		</ContactName>
		<Address>
			<AddressLine2></AddressLine2>
			<AddressLine3>3660 NW 114 Ave</AddressLine3>
			<City>Miami</City>
			<State>FL</State>
			<PostalCode>33178</PostalCode>
			<CountryID>840</CountryID>
		</Address>
	</ContactAddress>
	<PhoneNumber>
		<PhoneNumDigits>8005551212</PhoneNumDigits>
	</PhoneNumber>
	<Email>janrrot@example.com</Email>
	<SourceCode>SPPS</SourceCode>
</Customer>
</CatalogRequest>
<CatalogRequest ID="1234567901">
<Customer>
	<ContactAddress>
		<ContactName>
			<FirstName>Mark</FirstName>
			<MiddleInitial>R</MiddleInitial>
			<LastName>Freeze</LastName>
			<Company>UFO</Company>
			<Title>CEO</Title>
		</ContactName>
		<Address>
			<AddressLine2></AddressLine2>
			<AddressLine3>555 Schenker St</AddressLine3>
			<City>Addison</City>
			<State>IL</State>
			<PostalCode>60101</PostalCode>
			<CountryID>840</CountryID>
		</Address>
	</ContactAddress>
	<PhoneNumber>
		<PhoneNumDigits>9876543210</PhoneNumDigits>
	</PhoneNumber>
	<Email>mrfreeze@example.com</Email>
	<SourceCode>SS4</SourceCode>
</Customer>
</CatalogRequest>
</CatalogRequests>
</CMSData>

confirmOrdersReceived

Sample Request

Here we're sending a list of the orders that were successfully downloaded into CMS. The item list is the RefOrderID referenced in the downloadOrders response.
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soapinterop.org/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:confirmOrdersReceived soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <store_id xsi:type="xsd:integer">2226</store_id>
         <username xsi:type="xsd:string">cms_test</username>
         <password xsi:type="xsd:string">testpass</password>
         <order_ids xsi:type="soap:ArrayOfstring" soapenc:arrayType="xsd:string[]">
		<item>17</item>
		<item>18</item>
	 </order_ids>
         <catalog_ids xsi:type="soap:ArrayOfstring" soapenc:arrayType="xsd:string[]"/>
      </soap:confirmOrdersReceived>
   </soapenv:Body>
</soapenv:Envelope>

Sample Response

This does not send xml back but a normal response is sent 1 being successful 0 something didn't go right with the confirmation:
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd">
   <SOAP-ENV:Body>
      <confirmOrdersReceivedResponse>
         <return xsi:type="xsd:boolean">1</return>
      </confirmOrdersReceivedResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Sample POST from CV3

POST https://ecms.commercev3.com/services/serviceCV3.php HTTP/1.1 SOAPAction: "https://ecms.commercev3.com/services/serviceCV3.php/downloadOrders" Content-Type: text/xml; charset="utf-8" User-Agent: CodeGear SOAP 1.3 Host: ecms.commercev3.com Content-Length: 647 Connection: Keep-Alive Cache-Control: no-cache Cookie: PHPSESSID=2v0mun751jldmk4hjbhlrtlbn2

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body xmlns:NS1="http://soapinterop.org/" SOAP-
 
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><NS1:downloadOrders><store_id xsi:type="xsd:int">2452</store_id><username 
 
xsi:type="xsd:string">nhsXXteX</username><password xsi:type="xsd:string">cXXXXX6</password><version xsi:type="xsd:string">5.0</version></NS1:downloadOrders></SOAP-
 
ENV:Body></SOAP-ENV:Envelope>

Personal tools