CV3 Web Service Replication

From NewHaven Software Wiki

(Difference between revisions)
Jump to: navigation, search
m (moved RubbishDump to CV3 Web Service Replication over redirect)
m
Line 6: Line 6:
*createAccount  
*createAccount  
*getAccount  
*getAccount  
-
*'''[http://wiki.newhavensoftware.com/index.php/CV3_Webservice_Replication#getStoresForAccount getStoresForAccount]'''  
+
*'''[http://wiki.newhavensoftware.com/index.php/CV3_Web_Service_Replication#getStoresForAccount getStoresForAccount]'''  
*createStore  
*createStore  
*echoBase64Variation  
*echoBase64Variation  
Line 13: Line 13:
*echoDecimal  
*echoDecimal  
*echoBoolean  
*echoBoolean  
-
*'''[http://wiki.newhavensoftware.com/index.php/CV3_Webservice_Replication#downloadOrders downloadOrders]'''  
+
*'''[http://wiki.newhavensoftware.com/index.php/CV3_Web_Service_Replication#downloadOrders downloadOrders]'''  
-
*'''[http://wiki.newhavensoftware.com/index.php/CV3_Webservice_Replication#confirmOrdersReceived confirmOrdersReceived]'''  
+
*'''[http://wiki.newhavensoftware.com/index.php/CV3_Web_Service_Replication#confirmOrdersReceived confirmOrdersReceived]'''  
*importProducts  
*importProducts  
*exportProducts  
*exportProducts  

Revision as of 01:06, 22 November 2011

In order to create a web service that CMS can talk to, that mimics the CV3 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

Contents

About Responses

All responses are base64 encoded and look like this:
<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>
      <getStoresForAccountResponse>
         <return xsi:type="xsd:base64Binary">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiID8+Cgo8U3RvcmVzPgogICA8U3RvcmU+CiAgICAgIDxJRD4yMjI2PC9JRD4KICAgICAgPE5hbWU+Y21zVGVzdFN0b3JlPC9OYW1lPgogICA8L1N0b3JlPgogICA8U3RvcmU+CiAgICAgIDxJRD4yNTg1PC9JRD4KICAgICAgPE5hbWU+R2FtZXMgYnkgTWFpbDwvTmFtZT4KICAgPC9TdG9yZT4KPC9TdG9yZXM+Cg==</return>
      </getStoresForAccountResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
All the responses below are only the encoded section which is a base64 encoded xml file.

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

getStoresForAccount

Sample Request

Here we send the auth info to get the store information (see the response example)
<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:getStoresForAccount soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <username xsi:type="xsd:string">cms_test_user</username>
         <password xsi:type="xsd:string">password</password>
      </soap:getStoresForAccount>
   </soapenv:Body>
</soapenv:Envelope>

Sample Response

You can see here an ID and Store Name are returned. CMS uses these to create the order source. At least one number and name combination are required. Though the name and number are arbitrary to what the customer would like to see displayed in CMS.  
<?xml version="1.0" encoding="UTF-8" ?>
 
<Stores>
   <Store>
      <ID>2226</ID>
      <Name>TestStoreFirst</Name>
   </Store>
   <Store>
      <ID>2585</ID>
      <Name>TestStoreSecond</Name>
   </Store>
</Stores>

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>
Personal tools