使用 PHP 的 Microsoft Dynamics GP 10 Web 服务

发布于 2024-12-01 02:27:39 字数 203 浏览 3 评论 0原文

我们正在考虑使用 Microsoft Dynamics GP 10 Web 服务,并且希望使用 PHP 来创建/更新客户和销售...所以问题是:这是否可能,如果可能,有人知道那里有好的文档吗?

我没有找到任何使用 PHP 的东西,这个问题的另一部分是安全凭证,PHP 是否可以正确地通过所需的登录并与 GP 的 Web 服务完全交互?

有什么想法或已知资源吗?

We are considering the use of Microsoft Dynamics GP 10 Web Services and will want to use PHP to create / update customers and sales... So the question is: Is this possible and if so does anyone know of good documentation out there?

I am not finding anything out there with using PHP, another part of this question would be security credentials and if PHP can correctly pass the needed login and fully interact with GP's web service?

Any ideas or known resources?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故乡的云 2024-12-08 02:27:39

无论如何,我使用一组名为 eConnect 的存储过程来进行 GP 集成。它可能不是最优雅的解决方案,但效果相当不错。 Microsoft 也对 eConnect 进行了很好的记录。

如果您选择使用这种集成,那么熟悉 Dexterity 应用程序是明智的做法。学习 Dexterity 应用程序对对象和表映射有很大帮助,它应该可以从 Customer Source 免费下载。

以下是用于创建客户记录的 eConnect 存储过程的示例:

$sql = "declare @p115 int
set @p115=0
declare @p116 varchar(255)
set @p116=''                                                                                                             
exec dbo.taUpdateCreateCustomerRcd
@I_vCUSTNMBR = '123456',
@I_vCUSTNAME = 'Company Name',
@O_iErrorState = @p115 OUTPUT,                                                                  
@oErrString = @p116 OUTPUT                                                                                       

select @p115, @p116";

要执行它,只需执行如下操作(在本示例中使用 PHP ADODB):

<前><代码> gp_execute_sp($sql);

函数 gp_execute_sp($sql, $transactions = true) {
全局$DBGP;

if($交易)
$DBGP->StartTrans();
$rs = $DBGP->执行($sql);
if(is_object($rs) && !$rs->EOF) {
if($rs->fields['计算'] != 0) {
if($交易)
$DBGP->FailTrans();
抛出新的异常(get_error_desc($rs->fields['compulated']));

}
} elseif(!is_object($rs)) {
if($交易)
$DBGP->FailTrans();
throw new Exception("数据库连接错误。");

} 别的 {
if($交易)
$DBGP->FailTrans();
throw new Exception("存储过程没有返回结果。");
}

if($交易)
$DBGP->CompleteTrans();
}

函数 get_error_desc($value) {
全局$DBGP;

if(is_numeric($value)) {
$result = "没有错误";
$sql = "从 DYNAMICS..taErrorCode WHERE ErrorCode=? 中选择 ErrorDES?";
$rs = $DBGP->执行($sql, array($value));
if(!$rs->EOF) {
$result = $rs->fields['ErrorDesc'];
}
} 别的 {
$结果=$值;
}

返回$结果;
}

For what it's worth, I use a set of stored procedures called eConnect to do GP integrations. It may not be the most elegant solution, but it works fairly good. eConnect is also documented pretty well by Microsoft.

If you choose to use this kind of integration, it is wise to get familiar with the Dexterity Application. Learning the Dexterity Application helps a lot with object and table mappings and it should be a free download from Customer Source.

Here is an example of an eConnect stored procedure to create a customer record:

$sql = "declare @p115 int
set @p115=0
declare @p116 varchar(255)
set @p116=''                                                                                                             
exec dbo.taUpdateCreateCustomerRcd
@I_vCUSTNMBR = '123456',
@I_vCUSTNAME = 'Company Name',
@O_iErrorState = @p115 OUTPUT,                                                                  
@oErrString = @p116 OUTPUT                                                                                       

select @p115, @p116";

To execute it just do something like the following (using PHP ADODB in this example):

    gp_execute_sp($sql);


    function gp_execute_sp($sql, $transactions = true) {
        global $DBGP;

        if($transactions)
            $DBGP->StartTrans();
            $rs = $DBGP->Execute($sql);
                if(is_object($rs) && !$rs->EOF) {
                        if($rs->fields['computed'] != 0) {
                if($transactions)
                                    $DBGP->FailTrans();
                                throw new Exception(get_error_desc($rs->fields['computed']));            

                        }                                                                                                
                } elseif(!is_object($rs)) {                                                                              
            if($transactions)                                                                                            
                            $DBGP->FailTrans();                                                                          
                        throw new Exception("Database Connection Error.");

                } else {                                                                                                 
                    if($transactions)                                                                                    
                    $DBGP->FailTrans();                                                                                  
                        throw new Exception("Stored proceedure did not return a result.");                               
                }                                                                                                        

                if($transactions)                                                                                        
                    $DBGP->CompleteTrans(); 
   }

   function get_error_desc($value) {
        global $DBGP;

        if(is_numeric($value)) {
            $result = "No Error Available";
            $sql = "SELECT ErrorDesc FROM DYNAMICS..taErrorCode WHERE ErrorCode=?";
            $rs = $DBGP->execute($sql, array($value));
            if(!$rs->EOF) {
                $result = $rs->fields['ErrorDesc'];
            }
        } else {
            $result = $value;
        }

        return $result;
    }
雨落星ぅ辰 2024-12-08 02:27:39

我尚未使用 Dynamics GP,但根据我对开发人员指南的修订,有一个旧端点和一个本机端点,但两者都是 SOAP 服务,因此我认为您没有理由不能使用 PHP 的 SOAP 客户端。

$client = new SoapClient('http://machine_name:<port_number>/Dynamics/GPService');
$result = $client->GetCompanyList(...);

我不知道发生了什么......,但同样,上述情况没有理由不可能,因为 SOAP 被设计为与包括 PHP 在内的大多数语言一起工作,它只是不会像想象的那么简单。

编辑:使用 WSDL 到 PHP 类生成器可能会有所帮助。请参阅:从 wsdl 生成 php 代码

I have not yet used Dynamics GP but based on my reding of the developer guide there is a legacy endpoint and a native endpoint but both are SOAP services so I see no reason why you couldn't use PHP's SOAP client.

$client = new SoapClient('http://machine_name:<port_number>/Dynamics/GPService');
$result = $client->GetCompanyList(...);

I do not know what goes at ..., but again there is no reason the above shouldn't be possible since SOAP is designed to work with most languages including PHP, it just won't be as simple as it could be.

EDIT: It may be helpful to use a WSDL to PHP class generator. See: generate php code from wsdl

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文