Rank: Member
Joined: 6/27/2007(UTC) Posts: 63
|
Hey guys, is there any documentation for developing against the webservices and using the workflow? They're both great tools for us developers but it'd be nice to have somewhere to start or samples to work off of. I'm working on an inventory sync, for the short term it's going to be with a PHP driven website on another server mostly updating inventory in BV through the webservices. I took a quick look last night and it looks like I have to use the login method to generate a session token and use that to authenticate for subsequent webservice calls? Everntually I'll be migrating that other site to BV so the inventory sync will be easier, but I'm thinking that by leveraging the workflow (somehow) I could call the other site's webservice to update inventory whenever it's touched in the other. Any help anyone can provide that would be great. Thanks! |
|
|
|
|
Rank: Member
Joined: 11/5/2003(UTC) Posts: 2,136
Was thanked: 1 time(s) in 1 post(s)
|
You got the web service sequence right. Login to get a token, then pass the token to the methods you use.
The web service API follows, almost exactly, the "normal" API. That means that every page in BVAdmin is a sample. Look for similar functionality in a BVAdmin page and then use the corresponding code as a sample. For example, if the BVAdmin page call Catalog.Product.Insert, then you would use the Catalog_Product_Insert web method (I don't think this method exists...but the naming convension is accurate). |
|
|
|
|
Rank: Member
Joined: 6/27/2007(UTC) Posts: 63
|
Ok, well I've started to play around a bit with the webservices, I've sucessfully used the login method, generated a token, and passed on that token information to another request. I have everything working as it should, the SOAP request the both times around are exactly as they need to be, however, the second request, the tokenRequested keeps coming back as false and I'm not getting an empty result coming back from the query. It hasn't expired, and I'm using the same token information that's coming back from the login request - any ideas? The method I'm using is Catalog_InternalProduct_FindBySku and I'm passing the token and sku which I've verified through SQL does actually exist. Any help would be appreciated - thanks! |
|
|
|
|
Rank: Member
Joined: 11/5/2003(UTC) Posts: 2,136
Was thanked: 1 time(s) in 1 post(s)
|
This should work, where "bvc5" is the name of the web reference to WebServices3.asmx and "DEV1" is the SKU for one of the products. Code: Module Module1
Sub Main()
Dim service As New bvc5.WebServices3
Dim token As bvc5.AuthenticationToken token = service.Login("admin", "password")
If token.TokenRejected Then Console.WriteLine("You are not authorized to use BVC5 web services.") Exit Sub End If
Dim product As bvc5.Product product = service.Catalog_InternalProduct_FindBySku(token, "DEV1") If token.TokenRejected Then Console.WriteLine("You are not authorized to access the Catalog.")
Exit Sub End If
Console.WriteLine("sku: {0}", product.Sku) Console.WriteLine("name: {0}", product.ProductName)
End Sub
End Module
|
|
|
|
|
Rank: Member
Joined: 6/27/2007(UTC) Posts: 63
|
Andy, thanks a lot for your help and direction. But, unfortunately for this customization I'm actually building it in PHP using NUSOAP, so I'm not consuming the webservices like I would if I was using .NET. But, my SOAP request is properly formed: Code:
POST /webservices3.asmx HTTP/1.0 Host: myhost User-Agent: NuSOAP/0.7.2 (1.94) Content-Type: text/xml; charset=ISO-8859-1 SOAPAction: "[url=http://www.bvsoftware.com/Schemas/Bvc5/2006/01/WebServices3/Catalog_InternalProduct_FindBySku]http://www.bvsoftware.com/Schemas/Bvc5/2006/01/WebServices3/Catalog_InternalProduct_FindBySku[/url]" Content-Length: 791
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="[url=http://schemas.xmlsoap.org/soap/envelope/]http://schemas.xmlsoap.org/soap/envelope/[/url]" xmlns:xsd="[url=http://www.w3.org/2001/XMLSchema]http://www.w3.org/2001/XMLSchema[/url]" xmlns:xsi="[url=http://www.w3.org/2001/XMLSchema-instance]http://www.w3.org/2001/XMLSchema-instance[/url]" xmlns:SOAP-ENC="[url=http://schemas.xmlsoap.org/soap/encoding/]http://schemas.xmlsoap.org/soap/encoding/[/url]" xmlns:ns1512="[url=http://tempuri.org%22%3E[b][/b]/]http://tempuri.org">[/url]
<SOAP-ENV:Body>
<Catalog_InternalProduct_FindBySku xmlns="[url=http://www.bvsoftware.com/Schemas/Bvc5/2006/01/WebServices3%22%3E[b][/b]]http://www.bvsoftware.com/Schemas/Bvc5/2006/01/WebServices3">[/url]
<token>
<ExpirationDate>2007-08-31T15:47:55.505125-04:00</ExpirationDate>
<ExpirationDateUTC>2007-08-31T19:47:55.505125Z</ExpirationDateUTC>
<UserBvin>45696cb9-xxxx-xxxx-xxxx-b6ff99abe0b3</UserBvin>
<TokenRejected>false</TokenRejected>
<IsExpired>false</IsExpired>
</token>
<sku>mysku</sku>
</Catalog_InternalProduct_FindBySku>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
But my response comes back:
[code] HTTP/1.1 200 OK Connection: close Date: Fri, 31 Aug 2007 18:47:55 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Cache-Control: private, max-age=0 Content-Type: text/xml; charset=utf-8 Content-Length: 721
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body><Catalog_InternalProduct_FindBySkuResponse xmlns="http://www.bvsoftware.com/Schemas/Bvc5/2006/01/WebServices3"> <token> <Bvin /> <LastUpdated>0001-01-01T00:00:00</LastUpdated> <ExpirationDate>2007-08-31T15:47:55.505125-04:00</ExpirationDate> <ExpirationDateUTC>2007-08-31T19:47:55.505125Z</ExpirationDateUTC> <UserBvin>45696cb9-xxxx-xxxx-xxxx-b6ff99abe0b3</UserBvin> <TokenRejected>true</TokenRejected> <IsExpired>false</IsExpired> </token> </Catalog_InternalProduct_FindBySkuResponse> </soap:Body> </soap:Envelope></PRE>
The response doesn't make sense to me, according to the WebServices info it should return back something completely different - not just the token.
[/code] |
|
|
|
|
Rank: Member
Joined: 11/5/2003(UTC) Posts: 2,136
Was thanked: 1 time(s) in 1 post(s)
|
Here is most of a raw request from my test. I think you are missing the token <Bvin> element. Although you are also missing the <LastUpdated> element, I doubt if that plays into the logic. Code: POST /bvc5sp2/webservices3.asmx HTTP/1.1 Content-Type: text/xml; charset=utf-8 SOAPAction: "[url=http://www.bvsoftware.com/Schemas/Bvc5/2006/01/WebServices3/Catalog_InternalProduct_FindBySku]http://www.bvsoftware.com/Schemas/Bvc5/2006/01/WebServices3/Catalog_InternalProduct_FindBySku[/url]"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="[url=http://schemas.xmlsoap.org/soap/envelope/]http://schemas.xmlsoap.org/soap/envelope/[/url]" xmlns:xsi="[url=http://www.w3.org/2001/XMLSchema-instance]http://www.w3.org/2001/XMLSchema-instance[/url]" xmlns:xsd="<a target="_blank" href='http://www.w3.org/2001/XMLSchema">'>http://www.w3.org/2001/XMLSchema"></A>
<soap:Body>
<Catalog_InternalProduct_FindBySku xmlns="<a target="_blank" href='http://www.bvsoftware.com/Schemas/Bvc5/2006/01/WebServices3">'>http://www.bvsoftware.com/Schemas/Bvc5/2006/01/WebServices3"></A>
<token>
<Bvin>6c7d1c74-7ef8-40b7-95de-1c6c2009a229</Bvin>
<LastUpdated>0001-01-01T00:00:00</LastUpdated>
<ExpirationDate>2007-08-31T15:56:26.375-07:00</ExpirationDate>
<ExpirationDateUTC>2007-08-31T22:56:26.375Z</ExpirationDateUTC>
<UserBvin>30</UserBvin>
<TokenRejected>false</TokenRejected>
<IsExpired>false</IsExpired>
</token>
<sku>DEV1</sku>
</Catalog_InternalProduct_FindBySku>
</soap:Body>
</soap:Envelope>
|
|
|
|
|
Rank: Member
Joined: 6/27/2007(UTC) Posts: 63
|
Thanks again Andy, that's what I would have thought, but looking at the SOAP request definition at /webservices3.asmx?op=Catalog_InternalProduct_FindBySku doesn't show those values so I didn't include them. I still have some playing around to do this weekend and I'll try passing the entire token in instead of just those specific pieces of it.
btw Andy, all your help isn't for nothing, I'll be setting up a trial of your shipper in the next few weeks ;-) |
|
|
|
|
Rank: Member
Joined: 6/27/2007(UTC) Posts: 63
|
Well Andy, that was it, simple as that. Not sure why the webservice description doesn't have those fields but thanks for your help and quick responses! |
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.